Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2012-07-30 07:06:44
- alarius
- Member
- Registered: 2009-05-28
- Posts: 45
improve menu of <category_list>
Hi everybody. I’m trying to improve my menu capabilities; at this time I’m just using a simple form with
<txp:category_list parent="articles" exclude="articles" />
this outputs my left side menu with subcategory list:
news
travel
sport
clicking one on the list outputs the list of categroy articles. Is there the possibility to add some simple text above thta list?
for example selecting news have something like:
HERE IS A LIST OF WHAT HAPPENED
and then the list of news
Another question, supposing I have some children category, in sport there could be rugby, soccer, volley.
How obtain the list of that children category on the content page, by selecting sport on the side menu?
Offline
Re: improve menu of <category_list>
You could use conditional statements. Something like:
<txp:if_article_list>
<txp:if_category name="news">
<p>HERE IS A LIST OF WHAT HAPPENED</p>
</txp:if_category>
</txp:if_article_list>
And the 2nd question
<txp:if_article_list>
<txp:if_category name="sport">
<txp:category_list parent="sport" exclude="sport" />
</txp:if_category>
</txp:if_article_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 2012-07-30 07:39:55
- alarius
- Member
- Registered: 2009-05-28
- Posts: 45
Re: improve menu of <category_list>
ok, I wrote this code:
<txp:if_category name="news">
<p>HERE IS A LIST OF WHAT HAPPENED</p>
</txp:if_category>
<txp:if_category>
<h3><txp:category title="1" /></h3>
<div class="hfeed">
<txp:article form="article_listing" limit="500" />
<txp:if_category name="sport">
<txp:category_list parent="sport" exclude="sport" />
</txp:if_category>
It works well, thankyou colak, but do you think I write correctly ot there is a better way to write it?
In few words, i open and close the if_categoty
tag 3 times, is correct?
Thankyou again
Offline
Re: improve menu of <category_list>
I cannot think of a better way although there might be one.
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 2012-08-02 10:37:19
- alarius
- Member
- Registered: 2009-05-28
- Posts: 45
Re: improve menu of <category_list>
hi again, I have another question about this. The code I use gives to me the list of children category of “sport”:
<txp:if_category name="sport">
<txp:category_list parent="sport" exclude="sport" />
</txp:if_category>
is there the possibility to force some element in this piece of code to obtain a bold, or a bulleted list?
or a different colored text?
at the moment with that code I obtain a simple list (without bullets and normal text), probably taking the code somewhere on the style sheet.
Offline
Re: improve menu of <category_list>
Try <txp:category_list parent="sport" exclude="sport" wraptag="ul" break="li" />
for the list, otherwise you can use it as container:
<txp:category_list parent="sport" exclude="sport" wraptag="ul" break="">
<li<txp:if_category name='<txp:category />'> class="active"</txp:if_category>>
<txp:category title="1" link="1" />
</li>
</txp:category_list>
Last edited by etc (2012-08-02 13:25:59)
Offline
Pages: 1