Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-26 14:28:37

alzy
New Member
Registered: 2005-10-27
Posts: 7

Multiple different if_section conditions

This is what I have now and it’s obviously not working for me.

<code>
<txp:if_search>
<h1>Search Results</h1><txp:article searchsticky=1 /><p><txp:search_result_count />
<txp:else />
<txp:if_section name=”“>
<txp:article_custom limit=“1” form=“FrontPage” id=“132” />
<txp:else />
<txp:if_section name=“tag”>
<txp:tru_tags_handler />
<txp:else />
<txp:article listform=“articleList” />
</txp:if_section>
</txp:if_search>
</code>

<br>Desired output from the above:

1) Static front page
2) using the tru_tags plugin, i can see the www.example.com/tags page
3) articles listed by their titles only on section pages
4) no duplicate search results
5) my static homepage text not appearing on search results

I know it’s alot to ask for but with the above code, I managed to achieve all of them except the 2nd one. So I was wondering how do I handle so many different if_section conditions?

Appreciate any help. Thanks.

Offline

#2 2006-04-26 15:37:56

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Multiple different if_section conditions

Obvious and inefficient though it may seem, I’ve been using different if_section declarations, like:

<code><txp:if_section name=”“>default</if_section>
<txp:if_section name=“one”>section one</if_section>
<txp:if_section name=“one”>section two</if_section></code>

I don’t think you are allowed more than one <txp:else /> declaration per conditional.

Hope that helps.

Last edited by mrdale (2006-04-26 15:39:07)

Offline

#3 2006-04-26 16:51:30

alzy
New Member
Registered: 2005-10-27
Posts: 7

Re: Multiple different if_section conditions

Thanks for the heads up, I’ve made some changes to the code and it seems to be working perfectly now. I was initially annoyed by the duplicate search results

just to share if anyone’s interested.

<code>
<txp:if_search>
<h2>Search Results</h2>
<txp:article searchsticky=1 /><p>
<txp:search_result_count />
<txp:else />
<txp:if_section name=”“>
<txp:article_custom limit=“1” form=“FrontPage” id=“132” />
</txp:if_section>
<txp:if_section name=“tag”>
<txp:tru_tags_handler />
<txp:else />
<txp:article listform=“articleList” />
</txp:if_section>
</txp:if_search>
</code>

<br>thanks alot mrdale.

Offline

Board footer

Powered by FluxBB