Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-02-17 06:08:36
- azw
- Member
- Registered: 2007-01-29
- Posts: 279
Need a conditional for (A) true home page or (B) browse results page
Is there a conditional that will show whether visitor is on the true home page?
<txp:if_section name="">
isn’t enough because it also includes search results and browse results.
Or is there a conditional that can tell whether the visitor is on a page showing the results of a browse?
Or is there a way to determine if the requested URL contains “get data” (like: ?c=candy)?
I already have code that will determine if the page is search results:
<code>
<txp:if_section name=”“>
<txp:if_search>
<li id=“home” class=“level-1”><txp:link_to_home>Home</txp:link_to_home></li>
<txp:else />
<li id=“home” class=“active level-1”><span>Home</span></li>
</txp:if_search>
<txp:else />
<li id=“home” class=“level-1”><txp:link_to_home>Home</txp:link_to_home></li>
/txp:if_section>
</code>
BACKGROUND
(There is additional code for sections that can have individual article pages within a section. The home section doesn’t)
I set up the navigation so that there is not a live link when the visitor is on the main page of the current section.
So, if you’re looking at the first page of the News section, the text for “News” in the navigation will not be a link, just text. If you’re in any other page in the site (including a page within the News section, the News link will work.
Last edited by azw (2007-02-17 06:10:10)
Offline
#2 2007-02-17 06:37:40
- anoke
- Archived Plugin Author
- Registered: 2006-04-15
- Posts: 152
Re: Need a conditional for (A) true home page or (B) browse results page
Might any of glx_if series be useful?
- When chickens are cold, they roost in trees; when ducks are cold, they plunge into water -
Offline
Re: Need a conditional for (A) true home page or (B) browse results page
There’s one plugin doing that, but I can’t remember its name.
Too bad this thing isn’t in the core…
Offline
Re: Need a conditional for (A) true home page or (B) browse results page
Offline
#5 2007-02-17 13:22:37
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Need a conditional for (A) true home page or (B) browse results page
Or is there a way to determine if the requested URL contains “get data” (like: ?c=candy)?
<txp:if_category>
.
Try this (I’m not 100% certain if the nesting will work):
<txp:if_section name="">
<txp:if_search>
tags for search page
<txp:else />
<txp:if_category>
tags for category pages
<txp:else />
tags for home page
</txp:if_category>
</txp:if_search>
</txp:if_section>
There is also wet_if_page, but I’m not sure if this is what you need.
Offline
Re: Need a conditional for (A) true home page or (B) browse results page
You forgot the /author/ browsing setting, which is, iirc, the one that screw the core code on this.
Offline
#7 2007-02-18 06:14:40
- azw
- Member
- Registered: 2007-01-29
- Posts: 279
Re: Need a conditional for (A) true home page or (B) browse results page
I’ll take a look at those options. Thanks for the suggestions.
It’d be neat if the if_category idea worked. That’d be simple enough.
Maybe it’s possible to route the results pages of searches and category-browing to another URL. This idea here seems to provide a way:
http://forum.textpattern.com/viewtopic.php?id=12311
Offline
#8 2007-02-19 01:14:35
- azw
- Member
- Registered: 2007-01-29
- Posts: 279
Re: Need a conditional for (A) true home page or (B) browse results page
Jeremie, what did you mean by this:
bq. You forgot the /author/ browsing setting, which is, iirc, the one that screw the core code on this.
Is there some other possibility I need to consider?
For browsing, Els’ suggestion works: <txp:if_category>
Offline
#9 2007-02-19 10:58:42
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Need a conditional for (A) true home page or (B) browse results page
azw wrote:
Jeremie, what did you mean by this:
That is only if you’d want to browse author pages, I didn’t think you would because you didn’t mention it.
Offline
Re: Need a conditional for (A) true home page or (B) browse results page
It may be not a good idea to start a whole web design ignoring an option (unless he’s pretty damn sure he won’t ever use it) and building around it not being here.
I think the only proper way may well be glx_if_frontpage indeed. It’s a conditional, so it’s not everyone’s cup of tea, but he should work. I’ll test it soon, I’ll use the whole default browsing tool for a site I’m working on, and of course I need a specific frontpage, so I will need a way soon.
Offline
#11 2007-02-19 17:51:35
- azw
- Member
- Registered: 2007-01-29
- Posts: 279
Re: Need a conditional for (A) true home page or (B) browse results page
Thanks Els and Jeremie for explaining. Please let us know what you find out, Jeremie!
Offline