Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Front page riddle...
Alright I have a logic question…
I have a front page that has the following:
<txp:if_search>
<txp:article />
<txp:else />
<txp:article_custom section="blog" />
</txp:if_search>
But it turns out that the client wants category-based navigation… so what ends up happening is that I get urls like:
http://www.domain.com/category/category-name
I get the warning “no article tag” – and then it displays the article_custom.
I can add the following:
<txp:if_category>
<txp:article />
</txp:if_category>
But this still doesn’t solve the problem, because now under any category list I get the blog article listing – which should only show up when the front page is acting like the front page.
I am using stw_category_tree – is the best thing to do just create a dummy section called content that uses a different page template and use the section parameter? It seems like I should be able to achieve this with conditionals.
Offline
#2 2007-09-26 16:56:23
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Front page riddle...
You should be able to do something like this:
<txp:if_search>
<txp:article />
<txp:else />
<txp:if_category>
<txp:article />
<txp:else />
<txp:article_custom section="blog" />
</txp:if_category>
</txp:if_search>
Offline
Re: Front page riddle...
According to the wiki, that kind of nesting (using else) doesn’t work:
http://www.textpattern.net/wiki/index.php?title=Conditional_Tags#Nesting
I hope that is just something out of date… :)
Last edited by jagorny (2007-09-26 21:34:48)
Offline
Re: Front page riddle...
I don’t know why, but I decided to try the code mentioned above and it worked.
It would make sense for the conditional tags nesting example to be updated to reflect the fact that this sort of nesting does work. Tearing out hair pointlessly.
Thanks for the suggestion!
Offline
Re: Front page riddle...
jagorny wrote:
I don’t know why, but I decided to try the code mentioned above and it worked.
It would make sense for the conditional tags nesting example to be updated to reflect the fact that this sort of nesting does work. Tearing out hair pointlessly.
Thanks for the suggestion!
“Conditional tags may be nested, unless you are nesting a tag within the same tag.”
the wiki still applies. els’ code is not the same logic at all.
Last edited by iblastoff (2007-09-27 05:49:52)
Offline
#6 2007-10-01 05:50:31
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Front page riddle...
In other words, this is okay:
<txp:if_section><txp:if_category>
but this is not:
<txp:if_category><txp:if_category>
Offline
Pages: 1