Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-11-02 14:33:43
- matthijs
- Member
- Registered: 2008-12-15
- Posts: 32
Conditional tag "if home"?
I have been looking for a simple conditional tag to check for the home page. Does that exist? Something like txp:if_home
I could try
<txp:if_section>
<txp:else />
<txp:if_section />
but that is not so elegant. Any ideas? Thanks!
Offline
Re: Conditional tag "if home"?
Hi
<txp:if_section name="">
home, sweet, home
<txp:else />
not home
</txp:if_section>
Offline
Re: Conditional tag "if home"?
matthijs wrote:
I could try
<txp:if_section>
<txp:else />
<txp:if_section />
but that is not so elegant. Any ideas? Thanks!
Seems elegant enough to me, if all you want is to test for the default section as opposed to the home page per se. If it’s the empty code block you find inelegant, try:
<txp:if_section name="default">
...
</txp:if_section>
If what you want is to test for the home page itself, i.e. the page you see at your site’s base URL, I have a plugin for you.
Code is topiary
Offline
Pages: 1