Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-08-05 16:42:28
- ThePowerOfOne
- New Member
- Registered: 2007-08-05
- Posts: 1
configuring the startpage wiht conditional tags
Hi there,
I tried to configure my Startpage with conditional tags.. but I think there is something essential which i don´t understand about the way of work of txp.. well let me explain..
i have a default Start layout which should appear when my site is called. the main content should be an introducing text and three images.. i put this content in a form.. and included it so:
<txp:article_custom section="Start" form="Starttext" />
this works! on this startpage in the left column there also appear some news as excerpts.. which are included in a different way..
when i click on one of the news the full article is shown using another layout..
on every article I want a link to the category -> /category/news..
however, when i click there i want all the messages related to news to appear as a list..
but to show the Starttext only when the section Start is actived i put some conditional tags around, because i wanted to make another condition if category news is selected..
<txp:if_article_section name="Start">
<txp:article_custom section="Start" form="Starttext" />
</txp:if_article_section>
and testing this, there is an arror message “Article tags cannot be used outside an article context”
what is wrong about it?
i wanted to add another condition like:
<txp:if_article_category name="news">
<txp:article form="single" formlist="news" />
</txp:if_article_category>
is this the right way to manage these kind of situations?
thanks for your help!
Rafael
Offline
Re: configuring the startpage wiht conditional tags
You have to use the <txp:if_article_section />
tags inside your Starttext form.
Offline
#3 2007-08-07 07:25:28
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: configuring the startpage wiht conditional tags
<txp:if_category>
<!-- how you want category lists displayed -->
<txp:article />
<txp:else />
<txp:article_custom section="Start" form="Starttext" />
</txp:if_category>
If you are using search and not using a dedicated search page, you’ll need to account for searches too:
<txp:if_category>
<!-- how you want category lists displayed -->
<txp:article />
<txp:else />
<txp:if_search>
<!-- how you want search results displayed -->
<txp:article />
<txp:else />
<!-- default front page contents -->
<txp:article_custom section="Start" form="Starttext" />
</txp:if_search>
</txp:if_category>
Now for the other condition, if I understand what you’re asking for. “Starttext” form:
<txp:if_article_category name="news">
<!-- put contents of "news" form here -->
<txp:else />
<!-- put contents of current "Starttext" form here -->
</txp:if_article_category>
Offline