Skip to content

Commit cccb485

Browse files
committed
Add catgoery_list tree example
1 parent 41350a2 commit cccb485

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tags/category_list.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,28 @@ Or as a nested unordered list, starting at the "product-type" node:
150150
</txp:category_list>
151151
~~~
152152

153+
### Example 4: Nested list of locations
154+
155+
Given a category tree:
156+
157+
* Location
158+
* Europe
159+
* London
160+
* Paris
161+
* Rome
162+
* North America
163+
* Los Angeles
164+
* New York
165+
* Texas
166+
167+
To output the above list of locations (excluding the top level) as a hyperlinkable, nested <code>ul/li</code> list, use a valueless <code>children</code> attribute:
168+
169+
~~~ html
170+
<txp:category_list parent="location" children label="All locations" labeltag="h2" wraptag="ul" break="li" exclude="location">
171+
<txp:category title link />
172+
</txp:category_list>
173+
~~~
174+
153175
This code will add `class="active"` to the `<li>` element around the current viewed category in the list, allowing your to style it with CSS as desired.
154176

155177
Other tags used: [category](/tags/category), [if_category](/tags/if_category).

0 commit comments

Comments
 (0)