Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Check if it is the last page in the category

Quote Reply
Check if it is the last page in the category
I am trying to direct the user to some other URL in the last page of a category; therefore, I create a link in category.html (i do not want to use the paging tool bar) to work like paging but with more control in it. But my "if" statement is not working somehow.. it does not show if I am in the last page or not...
I run dynamic links.

this is the code that I am trying to use:
Code:


<%if paging.current_page ne paging.num_hits%> (means if I did not reach the last page yet)
<a href="<%next%>">Next </a> (then show the next)
<%else%>
<%go to some other URL%> (otherwise, I am in the last page of the category go somewhere else next)
<%endif%>

Any help.. thanks much
Quote Reply
Re: [Mark2] Check if it is the last page in the category In reply to
what is the values of paging.current_page and paging.num_hits?

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] Check if it is the last page in the category In reply to
Well! I run a dump on the category.html and got the following (this is just an example):

Code:

paging{
'current_page' => '1',
'max_hits' => '1',
'num_hits' => '3',
'page' => '4/',
'page_format' => '1'

but it seems I can not put a comparison code on category.html to look for these numbers (it is not working)... or maybe I am doing it all wrong.
I want the flexablity to display what page should appear next ..

So I am playing with UTIL.PM file (but I am not a perl programmer) to create a new style=4 to specify my own way to navigate. which I want a way to go to NEXT page only (without previous...etc) and when I reach the last page, I want to be able to specify a new page to jump to .. something like:
If I have 4 pages in a category, I want to see only "Next Page" on each and something else on the last page:

Next Page --> Next Page --> Next Page --> <%Go to Some other URL based on category %>

so I think the trick will be to create new style in util.pm to this.. or global.. no idea...


Thanks again Philip for your help and if you still have some energy can you see my response on this one please:
http://www.gossamer-threads.com/...;;page=unread#unread
thanks much again
Mark
Quote Reply
Re: [Mark2] Check if it is the last page in the category In reply to
trying changing

<%if paging.current_page ne paging.num_hits%>

to

<%if paging.current_page != $paging.num_hits%>

You need != instead of ne because you're comparing numbers, and a $ is required on the right hand side of a comparison if the value comparing against is another template tag.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy logic] Check if it is the last page in the category In reply to
Worked very nicely ... thanks much Philip for all your help and regards.... ;)