Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Showing the contents of <txp:excerpt /> when user clicks on link
The context is an individual article.
The article has many custom fields, txp:body and txp:excerpt
The body has a link. when the link is clicked i want to hide the article txp:body and show a txp:custom_field or txp:excerpt.
<!-- initial txp:body output -->
<txp:variable name="order" value="1" />
<a href='<txp:permlink />?order=<txp:variable name="order" />'>Place an order</a>
But when i click the link it does not change the rendered contents?
Why is this?
<!-- The form i want to use to render either the txp:body or the txp:excerpt based on if the link has set the value the same article to 1 -->
<txp:if_variable name="order" value="" />
<txp:body />
</txp:if_variable>
<txp:if_variable name="order" value="1">
<txp:excerpt />
</txp:if_variable>
Last edited by Timid&friendly (2010-06-15 06:16:23)
I think, therefore I AM, … … er … I think :-?
Offline
Re: Showing the contents of <txp:excerpt /> when user clicks on link
The code you’ve shown has two variables, bestellen
and order
. You haven’t shown any code in which order
is given a value.
Code is topiary
Offline
Re: Showing the contents of <txp:excerpt /> when user clicks on link
Typos sry Bestellen=order (it’s Dutch for order) apologies. I have corrected the original post
Last edited by Timid&friendly (2010-06-15 04:23:29)
I think, therefore I AM, … … er … I think :-?
Offline
Re: Showing the contents of <txp:excerpt /> when user clicks on link
Variables don’t last from page to page, which is why you pass it via the URL. You need adi_gps to grab the value from the URL and put it into your variable. Install adi_gps and use the following code:
<txp:adi_gps name="order" quiet="1" />
<txp:if_variable name="order" value="1" />
<txp:excerpt />
<txp:else />
<txp:body />
</txp:if_variable>
TXP Builders – finely-crafted code, design and txp
Offline
Re: Showing the contents of <txp:excerpt /> when user clicks on link
Thx so much for the tip. It’s working fantastically!
I think, therefore I AM, … … er … I think :-?
Offline