Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-09-26 15:10:19

jagorny
Member
From: Portland, OR
Registered: 2006-08-24
Posts: 39
Website

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

#3 2007-09-26 21:33:56

jagorny
Member
From: Portland, OR
Registered: 2006-08-24
Posts: 39
Website

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

#4 2007-09-27 04:39:40

jagorny
Member
From: Portland, OR
Registered: 2006-08-24
Posts: 39
Website

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

#5 2007-09-27 05:49:30

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

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

Board footer

Powered by FluxBB