
david at kineticode
May 15, 2011, 3:21 PM
Post #2 of 8
(590 views)
Permalink
|
|
Re: Nested list with Template Toolkit (2.0.1)
[In reply to]
|
|
On May 15, 2011, at 4:55 AM, Mike Raynham wrote: > I've recently started to experiment with Bricolage, and one of the first things that I wanted to do was define a method to allow the creation of nested lists (such as unordered and ordered lists). > > I came up with the following method, and would like to check if it is a sane way to do it. If it is, then it may be of use to others. > > Define new Element Type: > > Content type: Subelement > Key name: bullet_list > Name: Bullet list > > Add a custom field: > > Widget type: Text Box > Key Name: bullet_point > Label: Bullet point > Min. Occur.: 1 > > Save the bullet_list element, then add the bullet_list element as a subelement of itself. Yes, this works. In the past, I've also made lists that are a bit more general, allowing one to select what type of list (ordered or unordered) and also allow items to have multiple paragraphs, links to other documents, and code blocks. Here's the old Bricolage site template: https://github.com/bricoleurs/bricolagecms-templates/blob/master/templates/XHTML/list.mc There used to be a page on the site that showed element relationships graphically; Phillip, what happend to all that stuff? You should be able to get the idea, though. In case you need something more flexible. Best, David
|