Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-07-16 06:51:14
- aboswell
- Member
- Registered: 2004-11-08
- Posts: 26
Simplify sticky article code duplication
Here is my problem, and I have had it since I started using TXP. Let’s say I have 8 sections and all have their own specific sticky article. I can get them to display correctly with the code below, but, ugh, how ugly is the repition!
Is there any way to change this:
<code>
<txp:mdn_if_section section=“pocketpc”>
<txp:article_custom form=“section_headers” section=“pocketpc” status=“sticky” limit=“1”/>
</txp:mdn_if_section>
<txp:mdn_if_section section=“palm”>
<txp:article_custom form=“section_headers” section=“palm” status=“sticky” limit=“1”/>
</txp:mdn_if_section>
<txp:mdn_if_section section=“blackberry”>
<txp:article_custom form=“section_headers” section=“blackberry” status=“sticky” limit=“1”/>
</txp:mdn_if_section>
<txp:mdn_if_section section=“phones”>
<txp:article_custom form=“section_headers” section=“phones” status=“sticky” limit=“1”/>
</txp:mdn_if_section>
<txp:mdn_if_section section=“mediaplayers”>
<txp:article_custom form=“section_headers” section=“mediaplayers” status=“sticky” limit=“1”/>
</txp:mdn_if_section>
<txp:mdn_if_section section=“misc”>
<txp:article_custom form=“section_headers” section=“misc” status=“sticky” limit=“1”/>
</txp:mdn_if_section>
<txp:mdn_if_section section=“custom”>
<txp:article_custom form=“section_headers” section=“custom” status=“sticky” limit=“1”/>
</txp:mdn_if_section>
<txp:mdn_if_section section=“extras”>
<txp:article_custom form=“section_headers” section=“extras” status=“sticky” limit=“1”/>
</txp:mdn_if_section>
</code>
to something like this:
<code>
<txp:mdn_if_section section=“pocketpc, palm, blackberry, phones, mediaplayers, misc, custom, extras”>
<txp:article_custom form=“section_headers” status=“sticky” limit=“1”/>
</txp:mdn_if_section>
</code>
and still have the correct article (and not the last one posted like the above code returns) showing up in the correct section.
Thanks,
Aaron
Offline
#2 2006-07-16 10:16:18
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Simplify sticky article code duplication
Is there a reason why
<code>
<txp:if_section name=“pocketpc,palm,blackberry,phones,mediaplayers,misc,custom,extras”>
<txp:article form=“section_headers” status=“sticky” limit=“1” />
</txp:if_section>
</code>
wouldn’t work?
Offline
#3 2006-07-17 04:29:49
- aboswell
- Member
- Registered: 2004-11-08
- Posts: 26
Re: Simplify sticky article code duplication
Thanks so much. Some times the simplest answer eludes me.
Aaron
Offline