I'm a complete n00b and I need some help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ianmyers
Forum Newbie
Posts: 1
Joined: Mon Feb 14, 2011 9:27 pm

I'm a complete n00b and I need some help

Post by ianmyers »

I'm moving my wordpress blog and I'm modifying one of the "URL generators". The blog is http://cruc.es and if you go to the bottom of the page you will see the numbers indicating pages. I got those to work by the next and the previous function are not working. I don't know enough about PHP to fix it. The code snippet is below and any help would be appreciated.

if ( $query->found_posts > $query->query_vars["posts_per_page"] ) {
echo '<ul class="paging">';
// Previous link?
if ( $page > 1 ) {
echo '<li class="previous"><a href="'.$baseURL.'/page/'.($page-1).'/'.$qs.'">previous</a></li>';
}
// Loop through pages
for ( $i=1; $i <= $query->max_num_pages; $i++ ) {
// Current page or linked page?
if ( $i == $page ) {
echo '<li class="active">'.$i.'</li>';
} else {
echo '<li><a href="'.$baseURL.'/?paged='.$i.'/'.$qs.'">'.$i.'</a></li>'; <<<-- I fixed this by making it paged=
}
}
// Next link?
if ( $page < $query->max_num_pages ) {
echo '<li><a href="'.$baseURL.'/page/'.($page+1).'/'.$qs.'">next</a></li>';
}
echo '</ul>';
}
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: I'm a complete n00b and I need some help

Post by requinix »

You were able to alter the 1-X but not the Next and Previous links? :? It's basically the same thing except you have a short expression instead of a variable.
Post Reply