Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-02-26 09:54:00

Gallex
Member
Registered: 2006-10-08
Posts: 1,315

section/category/sub-category list

my current form:

<txp:section_list default_title='<txp:text item="Home" />' include_default="1" sections="companys,services,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" />
<txp:category_list type="article" wraptag="ul" break="li" section='<txp:section />' parent='<txp:section />' exclude='<txp:section />'>
<txp:category title="1" link="1" section='<txp:section />' />
</txp:category_list></li>
</txp:section_list>

how to include the sub-category into this code, so the menu will look

  • section1
    • category1
      • sub-category1
      • sub-category2
    • category2
  • section2

Offline

#2 2014-02-26 14:54:51

etc
Developer
Registered: 2010-11-11
Posts: 5,393
Website GitHub

Re: section/category/sub-category list

You can (not tested) add another category list after <txp:category title="1" link="1" section='<txp:section />' /> (fourth line):

<txp:category_list wraptag="ul" break="li" children="0" parent='<txp:category />' exclude='<txp:category />'>
<txp:category title="1" link="1" section='<txp:section />' />
</txp:category_list>

Offline

#3 2014-02-27 08:40:23

Gallex
Member
Registered: 2006-10-08
Posts: 1,315

Re: section/category/sub-category list

etc wrote #279292:

You can (not tested) add another category list after <txp:category title="1" link="1" section='<txp:section />' /> (fourth line):

better, but not yet…it duplicates sub-categorys (displays in two different places) like this:

  • section1
    • category1
      • sub-category1
      • sub-category2
    • sub-category1
    • sub-category2
    • category2
  • section2

Offline

#4 2014-02-27 10:43:29

etc
Developer
Registered: 2010-11-11
Posts: 5,393
Website GitHub

Re: section/category/sub-category list

Gallex wrote #279302:

it duplicates sub-categorys (displays in two different places)

is this unwanted? then add children="0" attribute also to your exterior category list.

Offline

#5 2014-02-27 10:47:56

Gallex
Member
Registered: 2006-10-08
Posts: 1,315

Re: section/category/sub-category list

one children="0" was missing from first <txp:category_list..

final code:

<txp:section_list default_title='<txp:text item="Avaleht" />' include_default="1" sections="ettevotted,ost-muuk,reklaam,kontakt" 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" />

<txp:category_list type="article" wraptag="ul" break="li" section='<txp:section />' children="0" parent='<txp:section />' exclude='<txp:section />'>
<txp:category title="1" link="1" section='<txp:section />' />
<txp:category_list wraptag="ul" break="li" children="0" parent='<txp:category />' exclude='<txp:category />'>
<txp:category title="1" link="1" section='<txp:section />' />
</txp:category_list>
</txp:category_list></li>

</txp:section_list>

thank’s etc

Last edited by Gallex (2014-02-27 10:49:18)

Offline

Board footer

Powered by FluxBB