Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2020-04-04 04:22:42

code365
Member
From: California
Registered: 2009-08-16
Posts: 110
Website

Categories List

Hi,

I am trying to figure out what I am doing wrong with categories. I have two section with different sub items but using the same page. In the categories I created the following down below. I only want to display the children. When I enter the parent name I get nothing.

  • Item A
    • Item A1
    • Item A2
  • Item B
    • Item B1
    • Item B2
     <txp:category_list parent="item-a, item-b" exclude=''"  wraptag="ul" break="" class="">
          <li>
              <txp:category title="1" link="1" />
          </li>
      </txp:category_list>

Offline

#2 2020-04-04 04:45:21

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

Re: Categories List

<txp:category_list parent="item-a,item-b" exclude="item-a,item-b"  wraptag="ul" break="li" class="">
<txp:category title="1" link="1" />
</txp:category_list>

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 2020-04-04 20:05:02

code365
Member
From: California
Registered: 2009-08-16
Posts: 110
Website

Re: Categories List

I still see the same items on both section.

Offline

#4 2020-04-05 05:13:24

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

Re: Categories List

OK, let me understand better. You have 2 sections, let’s call them sec1 and sec2. Then you have a number of categories, two of which are parent categories and the others are children categories. Let’s call them catA, catAa, catAb, catB, catBa, catBb.

What I understand you would like to see when visiting domain.tld/sec1/catA/ is a list of the children categories of catA. Correct?


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

Offline

#5 2020-04-05 23:46:27

code365
Member
From: California
Registered: 2009-08-16
Posts: 110
Website

Re: Categories List

Yes, you are correct.
I have a section called Outdoor and Lightning. When I click either section I want on the side of the page to show accent chairs and bistro etc.

  • outdoor
    • Accent Chairs
    • Bistro
  • Lighting
    • Table Lamps
    • Pendants Lamps
    • Chandeliers Lamps

Last edited by code365 (2020-04-05 23:47:54)

Offline

#6 2020-04-06 07:03:02

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

Re: Categories List

Untested:)

<txp:if_section name="outdoor">
<txp:category_list parent="item-a" exclude="item-a"  wraptag="ul" break="li" class="">
<txp:category title="1" link="1" />
</txp:category_list>
</txp:if_section>
<txp:if_section name="lighting">
<txp:category_list parent="item-b" exclude="item-b"  wraptag="ul" break="li" class="">
<txp:category title="1" link="1" />
</txp:category_list>
</txp:if_section>

You may be able to automate the above if the section and parent categories have the same name

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

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

Offline

#7 2020-04-06 14:32:17

code365
Member
From: California
Registered: 2009-08-16
Posts: 110
Website

Re: Categories List

OMG, Thank you so much.

this my version lol almost close:

<txp:if_section name="<txp:section/>">
        <txp:if_category category="outdoor,furniture" parent="1" name="anakin">
              <txp:category_list wraptag="ul" break="li" parent="furniture" children="n"/>
              <txp:else/>
              <txp:category_list wraptag="ul" break="li" parent="outdoor"  children="n"/>
        </txp:if_category>
</txp:if_section>

Offline

#8 2020-04-06 15:46:07

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

Re: Categories List

There was an issue with the quotes in the first line:)

<txp:if_section name='<txp:section/>'>
        <txp:if_category category="outdoor,furniture" parent="1" name="anakin">
              <txp:category_list wraptag="ul" break="li" parent="furniture" children="n"/>
              <txp:else/>
              <txp:category_list wraptag="ul" break="li" parent="outdoor"  children="n"/>
        </txp:if_category>
</txp:if_section>

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

Offline

#9 2020-04-07 04:29:35

code365
Member
From: California
Registered: 2009-08-16
Posts: 110
Website

Re: Categories List

Thank you for your help and time.

Offline

Board footer

Powered by FluxBB