Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-07-28 02:27:24

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Can't pass value to txp:variable with rss_uc tags (SOLVED)

I’m trying to make a category list that hides empty categories, using similar logic as described by Els in this thread, but using rss_unlimited_categories.

To start from the beginning, this works great without hiding empty categories:

<txp:category_list break="li" wraptag="ul">
<txp:category title="1" link="1" section="default" /> (<txp:rss_unlimited_category_count section='<txp:section />' name='<txp:category />' />)
</txp:category_list>

So, all I need to do is pass the value for <txp:rss_unlimited_category_count section='<txp:section />' name='<txp:category />' /> to a variable and check if it’s not empty (as rss_unlimited_category_count returns nothing if there is nothing to count). Strangely though, the txp:variable tag doesn’t seem to like the rss_uc tags inside of it. The example below should work, but it doesn’t:

<txp:category_list break="li" wraptag="ul">
<txp:variable name="count1" value='<txp:rss_unlimited_category_count section='<txp:section />' name='<txp:category />'  />' />
  <txp:if_variable name="count1" value="">
  <txp:else />
<txp:category title="1" link="1" section="default" /> (<txp:variable name="count1" />)
  </txp:if_variable>
</txp:category_list>

I also tried alternatively using the rss_unlimited_categories_article_list tag along with a form containing txp:title, again with no luck:

<txp:category_list children="0" break="li" wraptag="ul">
<txp:variable name="check1" value='<txp:rss_unlimited_categories_article_list section='<txp:section />' category='<txp:category />' limit="1" form="test" />' />
  <txp:if_variable name="check1" value="">
  <txp:else />
<txp:category title="1" link="1" section="default" /> (<txp:variable name="check1" />)
  </txp:if_variable>
</txp:category_list>

In both cases, the variable doesn’t get any value passed to it. I’m guessing this could have something to do with parsing txp tags within multiple single quotes? But, in the example Els came up with in the link above, he is certainly using a lot of nested single quotes, so maybe this is rss_uc / plugin specific? Any ideas?

Last edited by aswihart (2010-07-28 04:33:13)

Offline

#2 2010-07-28 03:06:17

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

Re: Can't pass value to txp:variable with rss_uc tags (SOLVED)

When nesting tags in tags in tags in tags… you need to escape each nested tag with one more single quote:

<txp:variable name="count1" value='<txp:rss_unlimited_category_count section=''<txp:section />'' name=''<txp:category />''  />' />

(note that the wrapping quotes on inner/deeper tags are still two single quotes)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2010-07-28 03:26:22

aswihart
Member
From: Pittsburgh, PA
Registered: 2006-07-22
Posts: 345
Website

Re: Can't pass value to txp:variable with rss_uc tags (SOLVED)

Excellent, thanks a lot for the tip Julian, I’m surprised I had never run into this issue before!

Offline

Board footer

Powered by FluxBB