Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-04-26 02:39:21

Distrahera
Member
Registered: 2008-09-20
Posts: 30

How do I set dynamic values inside a <txp:> tag?

I am trying to create a nested list rendering a list of articles with the category of the current iteration. Let me make it clearer:

This is all in a form called this way from my template:

template:

<txp:category_list parent="travel" form="blog-categories" wraptag="ul" break="li" />

form:

<txp:if_first_category>
   <txp:category wraptag="h2" />
   <txp:else />
      <ul class="blogs">
         <txp:category wraptag="li" link="1">
            <txp:category />
            <txp:article_custom form="article-list" category="<txp:category />" wraptag="ul" break="li" />
         </txp:category>
      </ul>
</txp:if_first_category>

I have noticed I can not set my category by filling it with “<txp:category />”, but I want the category to vary depending on what the current category is. I’m having some trouble explaining this, but if you read the code thuroughly I think you can make out what I am trying to do. Is there a way to do this, or a better solution?

Thanks!

Offline

#2 2009-04-26 02:57:30

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: How do I set dynamic values inside a <txp:> tag?

<txp:article_custom form="article-list" category="<txp:category />" wraptag="ul" break="li" />

change double quotes to single quotes:

<txp:article_custom form="article-list" category='<txp:category />' wraptag="ul" break="li" />

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2009-04-26 02:59:08

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: How do I set dynamic values inside a <txp:> tag?

If I understood correctly you need something like this:

<txp:if_first_category>
   <txp:category wraptag="h2" />
   <txp:else />
	<article_custom category='<txp:category />' wraptag="ul" break="li" class="blogs" form="article-list" />
</txp:if_first_category>

Offline

#4 2009-04-26 07:44:58

Distrahera
Member
Registered: 2008-09-20
Posts: 30

Re: How do I set dynamic values inside a <txp:> tag?

Oh, yeah. Thats it, thanks!

Offline

#5 2009-04-28 18:09:35

Sterculius
New Member
Registered: 2009-04-28
Posts: 4

Re: How do I set dynamic values inside a <txp:> tag?

Very nice. I was about to post asking the same question. Thanks!

Offline

Board footer

Powered by FluxBB