I'd like to generate a gallery by iterating over the children of a
particular page. Using #children, this is trivially easy. However, I'd
like to further iterate over a consistently named image folder in each
child folder, like 'images', and pull those out. Sample code:
{{#children}}
{{#images}}
<img src="{{path}}" alt="{{name}}">
{{/images}}
{{/children}}
With a directory structure:
1.Top Level
|--1.Sub Level 1
| `-- images
`--2.Sub Level 2
`---> images
This doesn't work, I suspect because mustache doesn't like it. Any
alternative thoughts?
{{# children}}
{{> partials/projects/item}}
{{/ children}}
Worked for me :)
Keep asking questions, I'd like to get some common use stuff into the default templates.
> To unsubscribe from this group, send email to tinytree+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
{{#images}}
<img src="{{path}}" alt="{{name}}" />
{{/images}}
and is called from the parent template inside the {{# children}}
section, but I'm still not having much success.
Looking at the mustache demo, http://defunkt.github.com/mustache/#demo,
it seems like the nested sections occur with a hash value that is an
array (the value of the "items" key). Is there any reason this would
have an effect?
On Mar 19, 5:06 pm, Ben Schwarz <ben.schw...@gmail.com> wrote:
> I made a little demo:
>
> {{#children}}
> {{#images}}
> <img src="{{path}}" alt="">
> {{/images}}
> {{/children}}
>
> {
> "children":[
> {"name": "Page name", "images":[{"path": "/path/to/image/1"}]},
> {"name": "Page name", "images":[{"path": "/path/to/image/2"}]},
> {"name": "Page name", "images":[{"path": "/path/to/image/3"}]}
> ]
>
> }
>
> Which renders as expected.
>
> If you want to zip-up your site and send over that page / content / image set I'd be happy to have a
> look to figure out what is happening.
>
> On 20/03/2010, at 4:59 AM, BenC wrote:
>
>
>
> > I've set this up as suggested, so that my partial has:
>
> > {{#images}}
> > <img src="{{path}}" alt="{{name}}" />
> > {{/images}}
>
> > and is called from the parent template inside the {{# children}}
> > section, but I'm still not having much success.
>
> > Looking at the mustache demo,http://defunkt.github.com/mustache/#demo,