Topic: Pagination

Hi there,

i recently redid my layout and this time decided to add a Pagination to the bottom of the pages. I currently use this code and it looks great, fits the layout and isn't messy:

<ul id="page">
<li class="previous-off">PREVIOUS PAGE</li>
<li class="active">1</li>
 * [url=?page=2]2[/url]

 * [url=?page=3]3[/url]

 * [url=?page=4]4[/url]

 * [url=?page=5]5[/url]

 * [url=?page=6]6[/url]

 * [url=?page=7]7[/url]

<li class="next">[url=?page=2]NEXT PAGE[/url]</li>
</ul>

But the problem i have is that it doesn't actually work! LOL! when i click 'Next Page' or any number page, it just redirects to the first page everytime. now in my template in CuteNews i have left 'News Pagination' blank, and presume that's the problem. But what exact code do i input for it to work, but also to keep my layout?

Thanks, Nirina
http://killer-fashion.tk/

Re: Pagination

isn't there a dropdwon pagination faq?

Re: Pagination

Hello Nirina,

have a look at the standard pagination... the code used to display the second page is (depends on $number parameter, $number = 5 in this case):

?start_from=6&


So the next page starts with the sixth article. In this case you have to manually add these links.
You could instead use the pagination in your template and change the code in shows.inc.php to fit your layout:

$prev_next_msg = preg_replace("'[prev-link](.*?)[/prev-link]'si", ...

$pages .= " ...

$prev_next_msg = preg_replace("'[next-link](.*?)[/next-link]'si", ...

The replacements should look sth. like this:

$prev_next_msg = preg_replace("'[prev-link](.*?)[/prev-link]'si", "<li class="previous">[url=$PHP_SELF?start_from=$prev&ucat=$ucat&archive=$url_archive&subaction=$subaction&id=$id&$user_query]\1[/url]</li>", $prev_next_msg);

$prev_next_msg = preg_replace("'[prev-link](.*?)[/prev-link]'si", "<li class="previous-off">\1</li>", $prev_next_msg); $no_prev = TRUE; }

$pages .= " * [url=$PHP_SELF?start_from=$pages_start_from&ucat=$ucat&archive=$url_archive&subaction=$subaction&id=$id&$user_query]$j[/url]
 ";

$pages .= " <li class="active">$j</li> ";

$prev_next_msg = preg_replace("'[next-link](.*?)[/next-link]'si", "<li class="next">[url=$PHP_SELF?start_from=$i&ucat=$ucat&archive=$url_archive&subaction=$subaction&id=$id&$user_query]\1[/url]</li>", $prev_next_msg);

Good luck http://cutephp.com/forum/style_emoticons/default/smile.gif


oh gosh i didn't really understand most of that...  http://cutephp.com/forum/style_emoticons/default/blink.gif

I messed around a bit today and now i have a different code, which i use in the CuteNews template, but the active number keeps going to the wrong side..

<div style="width:400; margin-bottom:30px;"> 
<div> 
<ul id="page"> 
<align="center"> 
<li class="previous-off">[prev-link]Previous Page[/prev-link]</li> 
 
<li class="active">{pages}</li> 
 
<li class="next">[next-link]Next Page[/next-link]</li>
 
</align> 
</ul> 
</div> 
<p></p>

 
It kind of works, except it's a bit messier and the active page always goes to the otherside.. http://i1084.photobucket.com/albums/j419/Killer-Fashion/kil1.jpg

Re: Pagination

<li class="active">{pages}</li> 

after CN is done you'dd have

<li class="active"> * 1
 * 2
 * 3
</li> 

i hope you see what's wrong with that picture.