Textpattern CMS support forum

You are not logged in. Register | Login | Help

#41 2017-07-01 10:09:25

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 243

Re: etc_tree: trees for geeky grandmas

i need to have like this with etc_tree to apply specifc class on the first <ul> and assign a class to those <li> which has submenu (<ul>), like this:

    <ul class="mainmenu">
        <li><a href="#">Home</a></li>
        <li class="has-submenu"><a href="#">Services</a>
            <ul>
                <li><a href="#">Service 1</a></li>
                <li><a href="#">Service 2</a></li>
            </ul>
        </li>
    </ul>

Offline

#42 2017-07-01 13:27:37

etc
Developer
Registered: 2010-11-11
Posts: 3,159
Website

Re: etc_tree: trees for geeky grandmas

Like this?

<txp:etc_query data='<txp:etc_tree id="0" />'
    replace="ul@@class=mainmenu;//li/ul/..@@class=has-submenu"
/>

etc_[ query | search | pagination | date | tree | cache ]

Offline

#43 2018-07-12 07:49:25

jpdupont
Member
From: Virton (BE)
Registered: 2004-10-01
Posts: 752
Website

Re: etc_tree: trees for geeky grandmas

I am looking to create a category tree, with parents> children, then articles belonging to this category. I want to limit categories and articles to a particular section.

I did a test with adi_cat_menu, everything is fine except that the parent categories are not shown
With etc_tree the tree is present, but I can not limit to a particular section, and in addition to avoid displaying empty sections. Where am I wrong ?

<txp:etc_tree circular="3" wraptag="" break="">
    <txp:category_list wraptag="ul" break="li" section="spectacles" parent='<txp:category />' exclude='<txp:category />' children="0">
        <txp:category title="1" link="0" />
        <txp:article_custom limit="999" category='<txp:category />' section="spectacles" sort="Posted desc" wraptag="ul" break="li">
            <txp:permlink>
                <txp:title/></txp:permlink>
        </txp:article_custom>
        <txp:etc_tree />
    </txp:category_list>
</txp:etc_tree>

See my test page and below my code with adi_cat_menu :

<txp:section_list wraptag="" break="">
    <txp:evaluate test="adi_cat_menu">
        <ul>
            <li>
                Section =
                <txp:section title="0" />
                <ul>
                    <txp:adi_cat_menu article_attr='sort="title asc"' section='<txp:section />' section_sensitive="1" link="0" />
                </ul>
            </li>
        </ul>
    </txp:evaluate>
</txp:section_list>

Offline

#44 2018-07-12 12:16:35

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,245
Website

Re: etc_tree: trees for geeky grandmas

Hi JP,

Would this tip be of help?


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

#45 2018-07-12 13:24:59

jpdupont
Member
From: Virton (BE)
Registered: 2004-10-01
Posts: 752
Website

Re: etc_tree: trees for geeky grandmas

Hi Yannis,

I just tested on my page, and I do not have the expected result. I feel that I do not understand the “section” attribute of category_list. —> Does it only display categories related to the section shown?

Jean-Pol

Offline

#46 2018-07-12 13:42:07

jpdupont
Member
From: Virton (BE)
Registered: 2004-10-01
Posts: 752
Website

Re: etc_tree: trees for geeky grandmas

This tips from ADI work as expected with the categories tree.

Now how give a section, and for this section give the articles of this section, listed/ordered in the category tree ?

Maybee give the main category the same name as the section ?

Offline

#47 2018-07-12 15:19:43

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,245
Website

Re: etc_tree: trees for geeky grandmas

Hi JP

You could try

...
<txp:category title="1" link="1" section='<txp:section />' />
...

or just leave the section attribute out all together… Note that the attribute appears twice in the tip.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

#48 2018-07-12 15:33:20

etc
Developer
Registered: 2010-11-11
Posts: 3,159
Website

Re: etc_tree: trees for geeky grandmas

jpdupont wrote #312991:

I feel that I do not understand the “section” attribute of category_list. —> Does it only display categories related to the section shown?

Nope, it only adds the supplied section to category URL.

You can try this (though no warranty applies): create a recursive catlist form

<txp:category_list children="-1" exclude parent wraptag="" break="">
    <txp:evaluate test="article_custom, output_form" wraptag="li">
        <txp:category />
        <txp:article_custom section="spectacles" category match="Category1" wraptag="ol" break="li">
            <txp:permlink><txp:title/></txp:permlink>
        </txp:article_custom>
        <txp::catlist wraptag="ul" />
    </txp:evaluate>
</txp:category_list>

and call it where needed

<txp::catlist wraptag="ul" />

etc_[ query | search | pagination | date | tree | cache ]

Offline

#49 2018-07-12 16:04:20

jpdupont
Member
From: Virton (BE)
Registered: 2004-10-01
Posts: 752
Website

Re: etc_tree: trees for geeky grandmas

Thanks Oleg ! Works fine !

I try now to pass the section as param of the form :

<txp::catlist wraptag="ul" lasection="spectacles" />

and

<txp:category_list children="-1" exclude parent wraptag="" break="">
    <txp:evaluate test="article_custom, output_form" wraptag="li">
        <txp:category />
        <txp:article_custom section='<txp:yield name="lasection" default="" />' category match="Category1" wraptag="ol" break="li">
            <txp:permlink><txp:title/></txp:permlink>
        </txp:article_custom>
        <txp::catlist wraptag="ul" />
    </txp:evaluate>
</txp:category_list>

But my code don’t work Now work !

Edit : The yield name don’t like laSection —> Must be lasection

With this modif, works fine ! Thanks again Oleg :-)

Last edited by jpdupont (2018-07-12 16:56:05)

Offline

#50 2018-07-12 23:46:28

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,653
Website

Re: etc_tree: trees for geeky grandmas

jpdupont wrote #312991:

Hi Yannis,

I just tested on my page, and I do not have the expected result. I feel that I do not understand the “section” attribute of category_list. —> Does it only display categories related to the section shown?

According to the docs (and my experience, for the little that that counts…), it restrict the output to the named section(s).

<txp:category_list section="apple, orange, pineapple" />

would only display articles in the sections named. That is not context sensitive.

Offline

Board footer

Powered by FluxBB