Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-04-20 01:20:42

nemozob
Member
Registered: 2008-04-15
Posts: 36

Using the 'section' name as a variable: can it be done?

Let’s say I have 10 sections and I want to display different content for each one. So, I would write…

<txp:if_section name=“section1”>
<txp:linklist class=“news” wraptag=“ul” form=“noted” break=“li” category=“section1” />
</txp:if_section>

<txp:if_section name=“section2”>
<txp:linklist class=“news” wraptag=“ul” form=“noted” break=“li” category=“section2” />
</txp:if_section>

<txp:if_section name=“section3”>
<txp:linklist class=“news” wraptag=“ul” form=“noted” break=“li” category=“section3” />
</txp:if_section>

…and repeat 7 more times.

What I want to write is:

<txp:if_section name=”{SECTION NAME VARIABLE HERE}”>
<txp:linklist class=“news” wraptag=“ul” form=“noted” break=“li” category=”{SECTION NAME VARIABLE HERE}” />
</txp:if_section>

Is there a way to do that?

Offline

#2 2008-04-20 01:45:46

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Using the 'section' name as a variable: can it be done?

If the section name and category are same, then you can try with asy_wondertag-plugin or 2860 :

<txp:asy_wondertag>
<txp:linklist class="news" wraptag="ul" form="noted" break="li" category="<txp:section />" />
</txp:asy_wondertag>

Last edited by Gocom (2008-04-20 01:46:02)

Offline

#3 2008-04-20 02:06:38

nemozob
Member
Registered: 2008-04-15
Posts: 36

Re: Using the 'section' name as a variable: can it be done?

Ah, yes that works. Thanks so much.

Offline

Board footer

Powered by FluxBB