Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-03-06 15:14:43

geoff777
Plugin Author
From: Benarrabá Andalucía Spain
Registered: 2008-02-19
Posts: 282
Website

<txp:if_last_article> problem

Hi,

I have a page that displays one article at a time.

Using <txp:article_custom> and by passing variables in the URL
I want two buttons to go to prev and next articles.

By counting I know when I’m at article 1.
I thought I could use <txp:if_last_article> to find the other end of the article list.

I’ve given myself a headache.

This is part of the form used by the article_custom tag

<txp:if_last_article><txp:adi_link url='<txp:site_url /><txp:variable name="section_name"/>' urlvars='story_number=<txp:variable name="story_number"/>&direction=0&section_name=<txp:variable name="section_name"/>' link_text="Next Story" />&nbsp;&nbsp;&nbsp;&nbsp;&darr; <txp:else/> <txp:adi_link url='<txp:site_url /><txp:variable name="section_name"/>' urlvars='story_number=<txp:variable name="story_number"/>&direction=up&section_name=<txp:variable name="section_name"/>' link_text="Next Story" />&nbsp;&nbsp;&nbsp;&nbsp; &darr; </txp:if_last_article>

Really the crucial variable is direction which is set to = “0” if last story or “up” to increment variables

Anyone any ideas???

Thanks

Geoff

Last edited by geoff777 (2009-03-06 15:22:01)


There are 10 types of people in the world: those who understand binary, and those who don’t.

Offline

#2 2009-03-07 00:00:12

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: <txp:if_last_article> problem

Hi Geoff,

You’re busy at the moment!

I’ve recently used <txp:if_last_article> for the first time in anger and it worked for me – a 100% record! The book says “It will display in both single article and article list modes”. So I not sure if I can really help you on this one.

But I wonder if you’re picking individual articles then you’ve taken the “output a list of articles” function away from the system, so maybe it then can’t tell you which is the last one anyway.

Do the standard <txp:link_to_next> & <txp:link_to_prev> tags not work in your scenario?

Just as an aside, in adi_link, any reason you’re using url='<txp:site_url /><txp:variable name="section_name"/>' rather than section="" for the current section or even section="mysection"?

Adi

Offline

Board footer

Powered by FluxBB