Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-12-30 17:29:36

shorebreak
New Member
Registered: 2006-12-30
Posts: 4

submenu depending on parent section?

how can i get a list of all child-sections of one parent-section?

i want to make a submenu which changes acordingly to the current parent-section.

i tried it with this and variations:

<txp:if_category name=“Kontakt”> <txp:category_list_sub parent=“Kontakt” break=” “ />
</txp:if_category>
<txp:if_category name=“Service”> <txp:category_list_sub parent=“Service” break=” “ />
</txp:if_category>
<txp:if_category name=“Preisrechner”> <txp:category_list_sub parent=“Produkte” break=” “ />
</txp:if_category>

but it doesn’t output anything. without the if_category it works (but it will not detect the parent and only display one child-section list).

Offline

#2 2006-12-30 17:33:14

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,027
Website GitHub Mastodon Twitter

Re: submenu depending on parent section?

To my knowledge sub_categories are not implemented yet. (Thanks els I stand corrected:)) Although there may be a plugin which offers that functionality. Maybe els’ suggestion might be of help

Last edited by colak (2006-12-31 09:16:39)


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 2006-12-30 18:47:54

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: submenu depending on parent section?

I assume you are talking about categories, not sections? Otherwise your code wouldn’t work at all. Also the ‘_sub’ thing doesn’t exist.
Have a good look at the txp:category_list tag. This should work:

<txp:if_category name="kontakt">
<txp:category_list parent="kontakt" exclude="kontakt" break=" " />
</txp:if_category>
<txp:if_category name="service">
<txp:category_list parent="service" exclude="service" break=" " />
</txp:if_category>
<txp:if_category name="preisrechner">
<txp:category_list parent="produkte" exclude="produkte" break=" " />
</txp:if_category>

Also, make sure your category names are all lowercase.

Offline

#4 2007-01-15 10:16:20

shorebreak
New Member
Registered: 2006-12-30
Posts: 4

Re: submenu depending on parent section?

ok the if_category seems to work BUT the exclude has no effect and under service it displays a sub-category of produkte!?

<div id="submenu">
<txp:if_category name="kontakt">
<txp:category_list parent="kontakt" exclude="kontakt" break=" " />
</txp:if_category>
<txp:if_category name="preisrechner">
<txp:category_list parent="produkte" exclude="produkte" break=" " />
</txp:if_category>
<txp:if_category name="produkte">
<txp:category_list parent="produkte" exclude="produkte" break=" " />
</txp:if_category>

<txp:if_category name="qualitaet">
<txp:category_list parent="qualitaet" exclude="qualitaet" break=" " />
</txp:if_category>
<txp:if_category name="referenzen">
<txp:category_list parent="referenzen" exclude="referenzen" break=" " />
</txp:if_category>
<txp:if_category name="service">
<txp:category_list parent="service" exclude="service" break=" " />
</txp:if_category>
</div>

Structur:
*Kontakt 1
*Preisrechner 1
*Produkte 1
  *Fahrzeugbeschriftungen 
  *Leistungstafeln 
  *Leuchttransparente 
  *Markenlogos 
  *Piktogramme 
  *Pylone 2
  *Signalbänder 
*Qualität 1
*Referenzen 1
*Service 1

Last edited by shorebreak (2007-01-15 10:22:45)

Offline

#5 2007-01-15 17:16:38

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: submenu depending on parent section?

Give wondertags a try. That should simplify your code to the following…

<div id="submenu">
   <txp:wondertag>
      <txp:category_list parent="<txp:category/>" exclude="<txp:category/>" break=" " />
   </txp:wondertag>
</div>

Doesn’t solve the other problem though. Perhaps stw_category_tree would help out.

In which case, I think it would look like (using different attributes to suit your needs);

<div id="submenu">
   <txp:wondertag>
      <txp:stw_category_list start="<txp:category/>" />
   </txp:wondertag>
</div>

Last edited by mrdale (2007-01-15 17:23:18)

Offline

Board footer

Powered by FluxBB