Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-06-14 18:59:23

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

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

#2 2010-06-14 19:56:23

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

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

#3 2010-06-15 04:22:14

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

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

#4 2010-06-15 07:44:51

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,000
Website GitHub

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

#5 2010-06-15 16:17:16

Timid&friendly
Member
From: The Netherlands
Registered: 2006-05-28
Posts: 252
Website

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

Board footer

Powered by FluxBB