1 (edited by bogaa 2005-03-10 15:57)

Topic: Mod rewrite pagination problem

Im trying to make "Clean Urls" and it's all working greath exept for the paginating part, I wat to turn :

http://localhost/pun/topic/viewtopic.php?id=4&p=2

into

http://localhost/pun/topic/4/sub/2

This is the code that needs to be changed (viewtopic.php), but no matte what I tried I couldnt remove the "&p=" from the variable $id
Any help on this would be very welcome, once this is finished I will post the entire code in here so everybody who wants
this code (and I know there are a lot of you out there) will have it. Thanks in advance

$num_pages = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);

$p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p'];
$start_from = $pun_user['disp_posts'] * ($p - 1);

// Generate paging links
$paging_links = $lang_common['Pages'].': '.paginate($num_pages, $p, 'viewtopic.php?id='.$id);

Re: Mod rewrite pagination problem

Erm, Rickard is already doing this
http://punbb.org/forums/viewtopic.php?id=6254

3

Re: Mod rewrite pagination problem

yeah I allready know, but Im doing it faster, the pagination links are the last part and then im done.

Re: Mod rewrite pagination problem

faster? hes already got it working download the 1.3 development version

Re: Mod rewrite pagination problem

@ bogaa

You need to edit /include/functions.php as well.

Just replace:

$pages[] = '<a href="'.$link_to.'&p=1">1</a>';

with:

$pages[] = '<a href="'.$link_to.'/1">1</a>';

and:

$pages[] = '<a href="'.$link_to.'&p='.$current.'">'.$current.'</a>';

with:

$pages[] = '<a href="'.$link_to.'/'.$current.'">'.$current.'</a>';

and:

$pages[] = '<a href="'.$link_to.'&p='.$num_pages.'">'.$num_pages.'</a>';

with:

$pages[] = '<a href="'.$link_to.'/'.$num_pages.'">'.$num_pages.'</a>'

This should do the trick.

6

Re: Mod rewrite pagination problem

Tnx spider, that's exactly what I needed.

7

Re: Mod rewrite pagination problem

Connorhd wrote:

faster? hes already got it working download the 1.3 development version

Is it up for download? Cuz I cant seem to find it, tnx.

Re: Mod rewrite pagination problem

http://dev.punbb.org