Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Template design and Front-End Code

Post Reply
 
Thread Tools
  #31  
Old 12-07-2008, 09:47 AM
Matthias70 Offline
forum loafer
 
Join Date: Dec 2008
Posts: 5
mod_rewrite question

Hi Joe,
I'm totally new to pixelpost. Your great theme is one of the reasons why I'm using it :-)

One question to your mod rewrite:
At the moment my urls with mod rewrite look like this
photoblog/p/1
photoblog/p/2

Is there a way to use mod rewrite, so urls would be like this?
photoblog/categoryname/imagename

Thanks
Matthias
Reply With Quote
  #32  
Old 12-07-2008, 02:13 PM
robackja's Avatar
robackja Offline
pp veteran
 
Join Date: Sep 2008
Location: Tucson, Arizona
Posts: 50
Quote:
Originally Posted by Matthias70 View Post
Hi Joe,
I'm totally new to pixelpost. Your great theme is one of the reasons why I'm using it :-)

One question to your mod rewrite:
At the moment my urls with mod rewrite look like this
photoblog/p/1
photoblog/p/2

Is there a way to use mod rewrite, so urls would be like this?
photoblog/categoryname/imagename

Thanks
Matthias
I think it has to do with the rewrite base. under RewriteEngine On in your htaccess, try putting this

RewriteBase /photoblog/

and let me know if that works for you or not.
__________________
The World in 35mm | joeroback.com | roback.cc
Reply With Quote
  #33  
Old 12-07-2008, 05:11 PM
Matthias70 Offline
forum loafer
 
Join Date: Dec 2008
Posts: 5
Hi Joe,
below you can see the htacces file.
RewriteBase /photoblog/ does not change anything.

Is an imagelink like
photoblog/nature/flower1
supported by your theme.

I read the forum and found some threads about a slug plugin.
Unfortunatley its only for pixelpost 1.5

Thanks
Matthias

PHP Code:
 RewriteEngine on
 RewriteBase 
/photoblog/
 
RewriteRule ^(about|downloads)/?$ index.php?x=$1
 RewriteRule 
^browse/?$ index.php?x=browse  
 RewriteRule 
^browse/([1-9][0-9]*)/?$ index.php?x=browse&pagenum=$1
 RewriteRule 
^browse/category/([1-9][0-9]*)/?$ index.php?x=browse&category=$1
 RewriteRule 
^browse/category/([1-9][0-9]*)/([1-9][0-9]*)/?$ index.php?x=browse&category=$1&pagenum=$2
 RewriteRule 
^browse/archive/(19|20)([0-9][0-9])[-](0[1-9]|1[012])/monthname/([^/]+)/?$ index.php?x=browse&archivedate=$1$2-$3&monthname=$4
 RewriteRule 
^browse/archive/(19|20)([0-9][0-9])[-](0[1-9]|1[012])/monthname/([^/]+)/([1-9][0-9]*)/?$ index.php?x=browse&archivedate=$1$2-$3&monthname=$4&pagenum=$5
 RewriteRule 
^browse/tag/([^/]+)/?$ index.php?x=browse&tag=$1
 RewriteRule 
^browse/tag/([^/]+)/([1-9][0-9]*)/?$ index.php?x=browse&tag=$1&pagenum=$2
 RewriteRule 
^comment/submitindex.php?x=save_comment
 RewriteRule 
^comment/([0-9]+)$ index.php?popup=comment&showimage=$1
 RewriteRule 
^(p|photo)/([0-9]+)$ index.php?showimage=$2
 RewriteRule 
^(p|photo)/([0-9]+)/rating/([1-5])$ index.php?showimage=$2&rating=$3
 RewriteRule 
^t/latest/?$ index.php?showthumb=latest&thumbtag=image
 RewriteRule 
^feeds/(rss|atom).xmlindex.php?x=$
Reply With Quote
  #34  
Old 12-07-2008, 06:40 PM
robackja's Avatar
robackja Offline
pp veteran
 
Join Date: Sep 2008
Location: Tucson, Arizona
Posts: 50
oh my gosh. i totally read your first post wrong. i was simultaneously answering an email that was related to RewriteBase and blindly replied to your msg. sorry about that.

What you are asking cannot be done without either having installed slug or modifying index.php. (I'm not sure exactly how slug does it, maybe they also modify index.php, never really looked into it)... but the 5 min howto would look like this (and i don't know how knowledgeable you are in web/php/mysql stuff)

Add a rewrite rule like this

RewriteRule ^photoblog/([^/]+)/([^/]+) index.php?showtitle=$2

I am not sure why you would put 'categoryname' in the URL, since it would have no purpose in the query, maybe just for a more informative URL?

Then you would have to modify index.php to select from database based on image title, instead of image id

PHP Code:
// Get Current Image.
if(!isset($_SESSION["pixelpost_admin"]))
{
    if(!isset(
$_GET['showtitle']) || $_GET['showtitle'] == "")
    {
        
$row sql_array("SELECT * FROM `".$pixelpost_db_prefix."pixelpost` WHERE `datetime` <= '$cdate' ORDER BY ".$cfgrow['display_sort_by']." ".$display_order." LIMIT 0,1");
    }
    else
    {
        
$row sql_array("SELECT * FROM `".$pixelpost_db_prefix."pixelpost` WHERE (`headline` = '".$_GET['showtitle']."') AND `datetime` <= '$cdate'");
    }
}
else
{
    if(!isset(
$_GET['showtitle']) || $_GET['showtitle'] == "")
    {
        
$row sql_array("SELECT * FROM `".$pixelpost_db_prefix."pixelpost` ORDER BY ".$cfgrow['display_sort_by']." ".$display_order." LIMIT 0,1");
    }
    else
    {
        
$row sql_array("SELECT * FROM `".$pixelpost_db_prefix."pixelpost` WHERE (`headline` = '".$_GET['showtitle']."')");
    }

And that needs to be placed next to the similar code that uses $_GET['showimage'] instead of $_GET['showtitle']. Again, having tested any of this, and i am just writing off the top of my head.
__________________
The World in 35mm | joeroback.com | roback.cc
Reply With Quote
  #35  
Old 12-07-2008, 06:56 PM
Matthias70 Offline
forum loafer
 
Join Date: Dec 2008
Posts: 5
Quote:
Originally Posted by robackja View Post
oh my gosh. i totally read your first post wrong. i was simultaneously answering an email that was related to RewriteBase and blindly replied to your msg. sorry about that.
;-) That is what I thought

I just asking this for SEO! I'm using wordpress for my blog and there it is standard to have URLs like the post title...

I thought your template with mod_rewrite would do the same.

So I think I have to wait like others in this thread
http://www.pixelpost.org/forum/showthread.php?t=4915

Would be great to have this feature as standard in pixelpost.

Thanks
Matthias
Reply With Quote
  #36  
Old 12-07-2008, 07:03 PM
robackja's Avatar
robackja Offline
pp veteran
 
Join Date: Sep 2008
Location: Tucson, Arizona
Posts: 50
Quote:
Originally Posted by Matthias70 View Post
I thought your template with mod_rewrite would do the same.

So I think I have to wait like others in this thread
http://www.pixelpost.org/forum/showthread.php?t=4915
yea, i just looked at it and slug addon actually modifies index.php for you. it also formats the title a little neater, removing any weird characters, etc.

and i would totally agree, slug (image title) and mod_rewrite URLs would be a great addition to pixelpost. I am currently running the SVN version of PP on my development server and looking into adding mod_write as a standard option in PP, but it close of end-of-semester and right now my time is short for play stuff like pixelpost
__________________
The World in 35mm | joeroback.com | roback.cc
Reply With Quote
  #37  
Old 12-07-2008, 07:09 PM
Matthias70 Offline
forum loafer
 
Join Date: Dec 2008
Posts: 5
Quote:
Originally Posted by robackja View Post
and i would totally agree, slug (image title) and mod_rewrite URLs would be a great addition to pixelpost. I am currently running the SVN version of PP on my development server and looking into adding mod_write as a standard option in PP, but it close of end-of-semester and right now my time is short for play stuff like pixelpost
Hi Joe,
great, I can wait ;-)
Thanks
Matthias
Reply With Quote
  #38  
Old 12-08-2008, 03:38 AM
jaywilliams's Avatar
jaywilliams+ Offline
Team Pixelpost
 
Join Date: Sep 2005
Posts: 1,003
Send a message via AIM to jaywilliams Send a message via MSN to jaywilliams Send a message via Yahoo to jaywilliams Send a message via Skype™ to jaywilliams
Hey, if you want to merge my slug addon into your addon and/or Pixelpost feel free.
__________________
Jay Williams | A Different View
Reply With Quote
  #39  
Old 12-08-2008, 06:52 PM
hicks0r Offline
pp regular
 
Join Date: May 2005
Posts: 38
One more question, How I link to a category in the image_template page, I put the category related to an image in the EXIF info of the photo, but when I click over it, the direction is wrong, I supposed it's becouse the mod_rewrite...

Can you help me ...

Try this http://www.enricmoreno.com/ push over the categorie down the EXIF info.

Thanks
__________________
ENRICMORENO dot COM | my pblog
Reply With Quote
  #40  
Old 12-08-2008, 07:10 PM
robackja's Avatar
robackja Offline
pp veteran
 
Join Date: Sep 2008
Location: Tucson, Arizona
Posts: 50
Quote:
Originally Posted by hicks0r View Post
One more question, How I link to a category in the image_template page, I put the category related to an image in the EXIF info of the photo, but when I click over it, the direction is wrong, I supposed it's becouse the mod_rewrite...
unfortunately, mod_rewrite is a giant hack currently in Pixelpost. Proper support needs to be added in future releases. To make those links use mod_write URLs, you have to modify index.php. You need to replace this line:

PHP Code:
$image_category_all       .= "<a href='".PHP_SELF."?x=browse&amp;category=$cat_id'>" .$cfgrow['catgluestart'] .$name .$cfgrow['catglueend']."</a> &nbsp;";
$image_category_all_paged .= "<a href='".PHP_SELF."?x=browse&amp;category=$cat_id&amp;pagenum=1'>" .$cfgrow['catgluestart'] .$name .$cfgrow['catglueend']."</a> &nbsp;"
with this

PHP Code:
$image_category_all       .= "<a href='".PHP_SELF."browse/category/$cat_id'>" .$cfgrow['catgluestart'] .$name .$cfgrow['catglueend']."</a> &nbsp;";
$image_category_all_paged .= "<a href='".PHP_SELF."/browse/category/$cat_id/1'>" .$cfgrow['catgluestart'] .$name .$cfgrow['catglueend']."</a> &nbsp;"
Also I noticed on your site, that the 'browse' page is not using mod_rewrite URLs. You need to replace your paged_archive.php addon with the one provided in the ZIP file. And then make sure using ADMIN interface that mod_rewrite URLs are enabled in the ADDON section.
__________________
The World in 35mm | joeroback.com | roback.cc
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 03:58 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs