Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-12-09 13:33:07

grig
New Member
Registered: 2006-08-07
Posts: 6

Nested category and article navigation menu, restricted to a section

I am following the example here and I wonder if it’s possible to restrict the results to the articles within a section. It would be very helpful as I’m using sections to implement a bilingual site, each section hosting content in its respective language.

Here is the code:

<ul>
<txp:category_list children="0" break="li">
  <txp:category title="1" link="0" />
  <txp:article_custom section='<txp:section />' category='<txp:category />' break="li" wraptag="ul" limit="999">
    <txp:permlink>
      <txp:title />
      <txp:if_last_article></txp:if_last_article>
    </txp:permlink>
  </txp:article_custom>
</txp:category_list>
</ul>

It almost does what I need, except that all categories are printed.

Any help is appreciated. Thank you.

Offline

#2 2011-12-09 13:51:25

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

Re: Nested category and article navigation menu, restricted to a section

Hi

I’m now working on a trilingual site (en,el,ru) so you are in luck:)

the way I went about it is that I created 3 sections named: en,el,ru and 3 categories with the same names as the sections. Under each one of the categories I created their sub categories and sub-sub categories after them. Here’s the menu script

<ul id="nav" class="sf-menu">
<li><a href="<txp:site_url />"><txp:if_section name="el">Αρχική</txp:if_section><txp:if_section name="default, en">Home</txp:if_section><txp:if_section name="ru">Главное</txp:if_section></a></li>
<txp:category_list  break="li" wraptag="" parent='<txp:section />' exclude='<txp:section />' children="0">
<txp:category title="1" link="1" section='<txp:section />' />
<txp:category_list parent='<txp:category />' exclude='<txp:category />' break="li" wraptag="ul">
<txp:category title="1" link="1" section='<txp:section />' />
</txp:category_list>
</txp:category_list>
</ul>

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 2011-12-09 14:53:41

grig
New Member
Registered: 2006-08-07
Posts: 6

Re: Nested category and article navigation menu, restricted to a section

Thank you for your swift reply.

I have created two categories, named them like the sections (en/fr) than made the original categories, sub-categories of each en/fr category. The category list is indeed restricted to one language but there are no articles under them. Is this the designed behavior or am I missing something?

Offline

#4 2011-12-09 15:33:18

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

Re: Nested category and article navigation menu, restricted to a section

Hi,

the above code just displays the menu without any articles.

Do you get a list of articles after clicking on the category?


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

Offline

Board footer

Powered by FluxBB