Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » How do I…?
  3. » nested menu

#1 2010-03-28 07:26:57

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

nested menu

I’m experimenting on my localhost with Els’ code here

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

I’m wondering if there is a way to include linked articles in there too. Thinking of ways to create a linked nested menu

  • category 1
    • article 1
    • article 2
  • category 2
    • sub-category 2a
      • article 3
      • article 4
    • sub-category 2b
      • article 5
  • category 3
    • article 6

etc


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2010-03-28 10:28:26

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

Re: nested menu

colak wrote:

I’m wondering if there is a way to include linked articles in there too.

Do you mean like this?

<txp:category_list children="0" wraptag="ul" break="">
   <li class="cat"><txp:category title="1" link="1" />
      <txp:category_list parent='<txp:category />' exclude='<txp:category />' wraptag="ul" break="" class="subcat_list">
         <li><txp:category title="1" link="1" /></li>
         <txp:article_custom category='<txp:category />'>
            <li><txp:permlink><txp:title /></txp:permlink></li>
         </txp:article_custom>
      </txp:category_list>
   </li>
</txp:category_list>

Offline

#3 2010-03-28 10:28:56

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Re: nested menu

Yiannis,

Have you see this other code from Els.
It seems to create what you need

http://txptips.com/display-section-sensitive-articles-and-category-title

Offline

#4 2010-03-28 10:30:47

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

Re: nested menu

jpdupont wrote:

Have you see this other code from Els.

Haha, I forgot that was already a TXP Tip :)

Offline

#5 2010-03-28 12:25:06

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

Re: nested menu

Els wrote:

Do you mean like this?

Yep:) I think that it will work! I’m trying different layouts on my localhost so as to relaunch neme.org.

jpdupont wrote:

Yiannis, Have you see this other code from Els.

Thanks jp. Wil have a look at that too:)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2010-04-01 15:48:51

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

Re: nested menu

No it doesn’t work as it does not parse articles which belong to parent categories

This is where I am at

<ul><li><a href="<txp:site_url />">Home</a></li>
<txp:category_list children="0" wraptag="" break="" class="">

<li><txp:category title="1" link="1" />
<ul><txp:article_custom category='<txp:category />' break="li">
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom></ul>

<txp:category_list parent='<txp:category />' exclude='<txp:category />' break="" wraptag="ul" class="">

<li><txp:category title="1" link="1" /></li>
<txp:article_custom category='<txp:category />'>
<li><txp:permlink><txp:title /></txp:permlink></li>
</txp:article_custom>
</txp:category_list>
</li>
</txp:category_list></ul>

which does not work either as it produces empty uls in parent categories which contain no articles. (all articles in those are in child categories)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

  1. Index
  2. » How do I…?
  3. » nested menu

Board footer

Powered by FluxBB