Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
tweaking the 4.07(no plug-in) dropdown menu
Hi I only want certain sections to have drop downs.
Can I just somehow put a list of the sections in the first conditional?
And also I want to have the dropdown sections active on all other sections of the site not just the currently selected one.
instead of:
<txp:if_section name='<txp:section />'>
<txp:if_section name="section1,section2,section3">
<txp:section_list exclude="this,that" default_title='<txp:text item="home" />' include_default="1" wraptag="ul" break="li">
<txp:if_section name='<txp:section />'><span class="arrow">»</span></txp:if_section>
<txp:section link="1" title="1" />
<txp:if_section name='<txp:section />'>
<txp:article_custom section='<txp:section />' wraptag="ul" break="li">
<txp:if_article_id>›</txp:if_article_id>
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
</txp:if_section>
</txp:section_list>
sorry for editing this one so much…
Thanks
Last edited by kvnmcwebn (2009-12-14 19:10:40)
its a bad hen that wont scratch itself.
photogallery
Offline
#2 2009-12-14 20:02:40
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: tweaking the 4.07(no plug-in) dropdown menu
If I understand you correctly:
<txp:section_list exclude="this,that" default_title='<txp:text item="home" />' include_default="1" wraptag="ul" break="li">
<txp:if_section name='<txp:section />'><span class="arrow">»</span></txp:if_section>
<txp:section link="1" title="1" />
<txp:if_section name="section1,section2,section3">
<txp:article_custom section='<txp:section />' wraptag="ul" break="li">
<txp:if_article_id>›</txp:if_article_id>
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
</txp:if_section>
</txp:if_section>
</txp:section_list>
Offline
Re: tweaking the 4.07(no plug-in) dropdown menu
Hi Els,
Im trying to limit the sections that have dropdowns in the section list menu.
All sections have articles and so will have dropdowns using the menu as is but I only really need to use dropdowns on 3 sections on the site. I suppose this navigation structure goes against the textpattern design philosophy but it’s kind of a unique navigation problem I’m working on.
The code you provided doesn’t seem to limit the dropdowns to the named sections.
<txp:if_section name="sectionwithdropdowns1,sectionwithdropdowns2,sectionwithdropdowns3">
It does allow the dropdowns to work from anywhere in the site though.
Best
kevin
Last edited by kvnmcwebn (2009-12-14 21:29:22)
its a bad hen that wont scratch itself.
photogallery
Offline
#4 2009-12-14 21:37:40
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: tweaking the 4.07(no plug-in) dropdown menu
kvnmcwebn wrote:
The code you provided doesn’t seem to limit the dropdowns to the named sections.
No, it wouldn’t. Sorry, didn’t think hard enough. Try this.
<txp:section_list exclude="this,that" default_title='<txp:text item="home" />' include_default="1" wraptag="ul" break="li">
<txp:if_section name='<txp:section />'><span class="arrow">»</span></txp:if_section>
<txp:section link="1" title="1" />
<txp:article_custom section='<txp:section />'>
<txp:if_article_section name="sectionwithdropdowns1,sectionwithdropdowns2,sectionwithdropdowns3">
<txp:if_first_article><ul></txp:if_first_article>
<li><txp:if_article_id>›</txp:if_article_id>
<txp:permlink><txp:title /></txp:permlink></li>
<txp:if_last_article></ul></txp:if_last_article>
</txp:if_article_section>
</txp:article_custom>
</txp:if_section>
</txp:section_list>
I’ve moved the wraptag and break to the inside of the if_article_section tag, because I suspect that otherwise it will display empty ul and li tags if the conditional returns false.
Edit: I assume that this code is not very efficient because it still checks all articles in the sections that don’t need a dropdown. So maybe smd_query would be a better choice.
Last edited by els (2009-12-14 21:41:48)
Offline
Re: tweaking the 4.07(no plug-in) dropdown menu
Hi Els,
That seems to be perfect. It’s not slowing anything down so it’s efficient enough for me. It’s breaking my layout but I should be able to figure that out. Thanks a mill.
Can’t seem to get that code to not break my layout.
Last edited by kvnmcwebn (2009-12-14 23:42:19)
its a bad hen that wont scratch itself.
photogallery
Offline
#6 2009-12-14 23:29:00
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: tweaking the 4.07(no plug-in) dropdown menu
Just noticed a typo: ›
:)
Offline
Re: tweaking the 4.07(no plug-in) dropdown menu
thanks for that, but still can’t figure it out els..
your code:
———
my old code:
———-
Your code seems to make <div class=“clearfloat”> </div> disappear from rendered html but I don’t know. Can’t figure it out.
Last edited by kvnmcwebn (2009-12-15 02:51:56)
its a bad hen that wont scratch itself.
photogallery
Offline
#8 2009-12-15 00:10:02
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: tweaking the 4.07(no plug-in) dropdown menu
Oh dear. I shouldn’t be answering posts this late… I left a </txp:if_section>
too many :(
New try:
<txp:section_list exclude="this,that" default_title='<txp:text item="home" />' include_default="1" wraptag="ul" break="li">
<txp:if_section name='<txp:section />'><span class="arrow">»</span></txp:if_section>
<txp:section link="1" title="1" />
<txp:article_custom section='<txp:section />'>
<txp:if_article_section name="sectionwithdropdowns1,sectionwithdropdowns2,sectionwithdropdowns3">
<txp:if_first_article><ul></txp:if_first_article>
<li><txp:if_article_id>»</txp:if_article_id>
<txp:permlink><txp:title /></txp:permlink></li>
<txp:if_last_article></ul></txp:if_last_article>
</txp:if_article_section>
</txp:article_custom>
</txp:section_list>
Offline
Re: tweaking the 4.07(no plug-in) dropdown menu
thanks els! working perfectly now. That’s a great piece of code.
Sorry for the hassle I should have caught that additional tag myself.
-kevin
Last edited by kvnmcwebn (2009-12-15 01:04:54)
its a bad hen that wont scratch itself.
photogallery
Offline