Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
make a navigation menu from article titles (with active state)
ok here is a tricky one (at least for me):
i need to generate a navigation menu from article titles. the site will have some sections, categories are not needed.
these sections contain articles. the url scheme should be /section/title. on each section i need a list of all articles in that section as a navigation menu (now to the tricky part) and an active state should be set on the article i’m currently viewing.
so the output when viewing the article “first post” should be something like this:
<ul> <li><a href="/section/first-post" id="active">first post</a></li> <li><a href="/section/second-post">second post</a></li> <li><a href="/section/third-post">third post</a></li> </ul>
i was experimenting with ako_nav, which looks at the url to set the active state but it didn’t work out. what i did was this:
<txp:asy_wondertag><txp:ako_nav name="<txp:article form="nav_title" />" url="<txp:article_custom form="nav_url" />" /></txp:asy_wondertag>
-> nav_title
:
<txp:title />,
-> nav_url
:
/<txp:php>echo $GLOBALS['thisarticle']['url_title'];</txp:php>,
this creates a navigation menu on the front page but when viewing an individual article, it breaks.
anyone ever did such a thing before and can come up with a clever, maybe non-plugin solution?
any help/ideas/hints on that topic would be highly appreciated!
Offline
Re: make a navigation menu from article titles (with active state)
I used $pretext[‘id’] == $thisarticle[‘thisid’].
Last edited by wet (2007-03-05 06:27:44)
Offline
Re: make a navigation menu from article titles (with active state)
you, wet, are my hero! :)
works like a charm.
Offline
#4 2007-03-05 18:19:15
- anoke
- Archived Plugin Author
- Registered: 2006-04-15
- Posts: 152
Re: make a navigation menu from article titles (with active state)
There’s also <txp:page_url type="id"/>
for $pretext[‘id’].
- When chickens are cold, they roost in trees; when ducks are cold, they plunge into water -
Offline