Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
need help with Section/Article Navigation
I use a “standard” section navigation,
<nav role="navigation">
<h1><txp:text item="navigation" /></h1>
<txp:section_list default_title='<txp:text item="home" />' include_default="1" sections="about, events, products, contact" wraptag="ul" break="">
<li<txp:if_section name='<txp:section />'><txp:if_search><txp:else /><txp:if_category><txp:else /><txp:if_author><txp:else /> class="active"</txp:if_author></txp:if_category></txp:if_search></txp:if_section>>
<txp:section title="1" link="1" />
</li>
</txp:section_list>
</nav>
and want to extend it with a dropdown on the product “tab”. The dropdown should include all article titles from the products section. I know how to do it with category_list, if all product articles have the same category. But I’m sure there is a possibility to do it without the use of categories, or isn’t it?
Greetz
[Axel]
Last edited by [Axel] (2013-07-17 13:09:46)
Greetz [Axel]
Offline
Re: need help with Section/Article Navigation
Hi Axel,
Would this tip be of help?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#3 2013-07-17 14:10:13
- GugUser
- Member

- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: need help with Section/Article Navigation
Scheme of one version of my ways to do this:
<nav role="navigation">
<ul>
<txp:if_status><li<txp:if_section name=","> class="active">Home<txp:else />><a href="/" accesskey="0">Home</a></txp:if_section></li><txp:else /><li><a href="/" accesskey="0">Home</a></li></txp:if_status>
<txp:section_list sections="about, events" break="" form="nav-sections" />
<txp:section_list sections="products" break="" form="nav-sections-articlelist" />
<li<txp:if_section name="contact"> class="active"><txp:section title="1" /><txp:else />><a href="/contact" accesskey="3"><txp:section name="contact" title="1" /></a></txp:if_section></li>
</ul>
</nav>
For the form “nav-sections” (¶ = replace with a not visible line break):
<li<txp:if_section name='<txp:section />'><txp:if_individual_article>><a class="active" href='/<txp:section />'><txp:section title="1" /></a><txp:else /> class="active"><txp:section title="1" /></txp:if_individual_article><txp:else />><a href='/<txp:section />'><txp:section title="1" /></a></txp:if_section></li>
¶
For the form “nav-sections-articlelist”:
<li<txp:if_section name='<txp:section />'> class="active"><txp:section title="1" />
<ul>
<txp:article_custom section='<txp:section />' limit="20" form="nav-articlelist" /></ul>
<txp:else />><a href="/<txp:section />"><txp:section title="1" /></a></txp:if_section></li>
¶
For the form “nav-articlelist”:
<li<txp:if_article_id id='<txp:article limit="1"><txp:article_id /></txp:article>'> class="active"><txp:title /><txp:else />><a href='<txp:permlink />'><txp:title /></a></txp:if_article_id></li>
¶
Last edited by GugUser (2013-07-17 14:17:46)
Offline
#4 2013-07-18 06:11:18
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: need help with Section/Article Navigation
Or if you don’t mind using a plugin: <txp:adi_menu articles="1" />
Offline
Re: need help with Section/Article Navigation
colak wrote:
Would this tip be of help?
Unfortunately not, because its giving a dropdown on every section, but I only need it on the product tab.
GugUser wrot:
Scheme of one version of my ways to do this:
That’s what I needed,
It looks complicated after the first glance, but it works out of the box. I only needed to modify it a bit, because the product page dropdown has to be available all the time (because of touch screen devices).
Anyway… THX a lot
[Axel]
Greetz [Axel]
Offline
Re: need help with Section/Article Navigation
As I just found out, the dropdown article list only appears if the product section is the active section.
But what I need is that the dropdown is on the products tab all the time, no matter what section is active.
I solved this tiny problem, but found a new one.
The product tab Page (if active) shows an articles-list with excerpts. in the dropdown navigation is the first article marked as active, even though all articles are displayed in list-form. There should be no active state while displaying the article-list page, only if an individual article is displayed.
Greetz [Axel]
Solved the problem too, by using ruuds rvm_if_this_article plugin with the following code in the nav_articlelist form instead of the one GugUser suggested.
<li class="<txp:rvm_if_this_article>active</txp:rvm_if_this_article>">
<a href="<txp:permlink />"><txp:title /></a>
</li>
THX again
[Axel]
Last edited by [Axel] (2013-07-18 15:36:29)
Greetz [Axel]
Offline
Re: need help with Section/Article Navigation
Doesn’t <txp:if_article_id>active</txp:if_article_id> give the same result that <txp:rvm_if_this_article>active</txp:rvm_if_this_article>?
Offline
#8 2013-07-18 20:36:51
- GugUser
- Member

- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: need help with Section/Article Navigation
etc wrote:
Doesn’t
<txp:if_article_id>active</txp:if_article_id>give the same result that<txp:rvm_if_this_article>active</txp:rvm_if_this_article>?
<txp:if_article_id>active</txp:if_article_id> works only for single articles. My suggestion works in article lists, without a plugin. It seems to me that ruuds plug-ins will no longer be updated.
Offline
Re: need help with Section/Article Navigation
that’s funny… that was the first thing I tried, and it did not work out, but now I tried it again and guess what…, it works!
THX etc that saved me a plugin :-D
Greetz [Axel]
Offline
#10 2013-07-18 21:03:36
- GugUser
- Member

- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: need help with Section/Article Navigation
Axel wrote:
that’s funny… that was the first thing I tried, and it did not work out, but now I tried it again and guess what…, it works!
What’s funny? Are you saying that <txp:if_article_id>active</txp:if_article_id> works in a nav article list? And what, if you need a different sort than default?
Offline
Re: need help with Section/Article Navigation
yes it does work, and I’m fine with the default sort order
Greetz [Axel]
Offline
#12 2013-07-18 21:46:37
- GugUser
- Member

- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: need help with Section/Article Navigation
Please, can you show me your code or write the context in witch this works? There must be a misunderstanding.
Offline
Re: need help with Section/Article Navigation
GugUser wrote #274109:
Scheme of one version of my ways to do this:
<nav role="navigation">...For the form “nav-sections” (¶ = replace with a not visible line break):
<li<txp:if_section name='<txp:section />'><txp:if_individual_article>><a class="active" href='/<txp:section />'><txp:section title="1" /></a><txp:else /> class="active"><txp:section title="1" /></txp:if_individual_article><txp:else />><a href='/<txp:section />'><txp:section title="1" /></a></txp:if_section></li>...For the form “nav-sections-articlelist”:
<li<txp:if_section name='<txp:section />'> class="active"><txp:section title="1" />...For the form “nav-articlelist”:
<li<txp:if_article_id id='<txp:article limit="1"><txp:article_id /></txp:article>'> class="active"><txp:title /><txp:else />><a href='<txp:permlink />'><txp:title /></a></txp:if_article_id></li>...
i decided to try this to automate my manual Navigation with a drop down list of categories for the Section Galleries. It does output al the sections but it doesn’t add the child sections to Galleries.
Are the forms types all Miscellaneous in your example or are some Article?
…. texted postive
Offline