Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Do something on the homepage but nowhere else?
I am doing a bunch of stuff <txp:if_section name="" > foo <txp:else/> bar </txp:if_section>
with the intent that foo will happen on the homepage and bar will happen everywhere else.
At the very least, foo also happens on the error_default 404 page. So, is there a conditional that will let me do stuff on the homepage only?
Yes, I have tried turning it off and on.
Offline
Re: Do something on the homepage but nowhere else?
alesh wrote #302889:
is there a conditional that will let me do stuff on the homepage only?
Does if_status help?
<txp:if_status>
<txp:if_section name="">
foo
<txp:else/>
bar
</txp:if_section>
<txp:else />
// Error page
</txp:if_status>
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Do something on the homepage but nowhere else?
Yep, that does it. Thanks!
Yes, I have tried turning it off and on.
Offline
Re: Do something on the homepage but nowhere else?
This is the method I have used for years.
<txp:variable name="task" value="frontpage" />
<txp:if_category><txp:variable name="task" value="category" /></txp:if_category>
<txp:if_search><txp:variable name="task" value="search" /></txp:if_search>
<txp:if_author><txp:variable name="task" value="author" /></txp:if_author>
I always assign a different page to search section so I never have to check for <txp:if_section name="" >
Offline