Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Category tree
I have emulated section tree by hand (presentational templates will remain quite steady), but I would let authors to set new categories for his articles.
Both txp:category_list
and txp:popup type="c"
work fine, but do not reflect subcategory dependence upon its parent category (and txp:popup
also reverts ?c="messy"
URLs). The following example is wrong, although I hope it will demonstrate what I am willing to achieve:
<dl id="c-tree">
<txp:category_list>
<txp:if_different>
<dt><txp:category1 title="1" link="1" /></dt>
</txp:if_different>
<dd><txp:category2 title="1" link="1" /></dd>
</txp:category_list>
</dl>
Offline
#2 2009-09-12 12:18:10
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Category tree
Not sure if this is what you’re after?
<dl id="c-tree">
<txp:category_list children="0">
<dt><txp:category title="1" link="1" /></dt>
<txp:category_list parent='<txp:category />' exclude='<txp:category />'>
<dd><txp:category title="1" link="1" /></dd>
</txp:category_list>
</txp:category_list>
</dl>
Offline
Re: Category tree
You are TxP wizard. And my redeemer, too. Because I am not a programmer, only HTML/CSS coder. That is where Textpattern especially helps. You could post this trick on Texpattern.net, Textpattern.org, or Txptips.com — I think that is the typical solution for the most of quite complex sites. Thank you very much!
Still one small problem in the output list, can you imagine — where unexpected <br />
line breaks shoot up from?
Last edited by Vienuolis (2009-09-12 16:23:22)
Offline
Re: Category tree
Vienuolis wrote:
Still one small problem in the output list, can you imagine — where unexpected
<br />
line breaks shoot up from?
Tag reference is your friend. Look what it says about break
attribute on category_list article. Yep, the default is <br />
which can be undone by setting the value to unset (adding break=""
to your <txp:category_list />
-tags).
Last edited by Gocom (2009-09-12 16:35:03)
Offline
Re: Category tree
Done, thanks!
Offline
Re: Category tree
The tree is context-sensitive: full on a front page (with consistent URLs), and section-limited elsewhere (/section/?c=“some-category”). It is OK, although there are some informational pages with no content, e.g. /index. Is it possible to avoid context-sensitivity in this form?
Offline
#7 2009-09-13 10:22:20
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Category tree
Hi Vladas, try this:
<dl id="c-tree">
<txp:category_list children="0">
<dt><txp:category section="default" title="1" link="1" /></dt>
<txp:category_list parent='<txp:category />' exclude='<txp:category />'>
<dd><txp:category section="default" title="1" link="1" /></dd>
</txp:category_list>
</txp:category_list>
</dl>
Offline
Re: Category tree
Oh, really, thank you!
Offline
Pages: 1