I prefer html-like templates becouse that - I belive - can be changed
by webdesigners without my intervention :)
Besides Aaron recomended SubtleTemplates on his blog so it may be good
choice to use on mootools-ready pages...

But if that wont work I may switch to jaml.

Thanks,
Robert

On 7 Lut, 17:39, Eneko Alonso <[email protected]> wrote:
> Mooml or Jaml are perfect for that. You can create your html template using
> jaml syntax and then pass the JSON data when it renders.
>
>
>
> On Sun, Feb 7, 2010 at 2:23 AM, Robert <[email protected]> wrote:
> > Hello,
> > I'm searching for template engine (HTML+JSON). I was testing PURE,
> > then I found SubtleTemplates by Thomas Aylott.
>
> > We are using mootools inhouse so I thoght it could be a better choice
> > but I am not sure about usage.
>
> > I have data like this:
>
> > var src = {
> >        "?xml": {
> >                "@version": "1.0",
> >                "@standalone": "no"
> >        },
> >        "root": {
> >                "group": [{
> >                        "@name": "Disk",
> >                        "action": [{
> >                                "@id": "document-new",
> >                                "@name": "New",
> >                                "@img-url": "img/document-new.png",
> >                                "@allowed": "1",
> >                                "@disabled": "0"
> >                        }, {
> >                                "@id": "document-open",
> >                                "@name": "Open",
> >                                "@img-url": "img/document-open.png",
> >                                "@allowed": "1",
> >                                "@disabled": "0"
> >                        }]
> >                },{
> >                        "@name": "Printer",
> >                        "action": [{
> >                                "@id": "document-print",
> >                                "@name": "Print",
> >                                "@img-url": "img/document-print.png",
> >                                "@allowed": "1",
> >                                "@disabled": "0"
> >                        }]
> >                }]
> >        }
> > }
>
> > I need template like this:
>
> > <div id="template">
> >        <ul id="root">
> >                <li class="SubtleTemplate group">
> >                        <div class="@nazwa">{gro...@name}</div>
> >                        <ul>
> >                                <li class="SubtleTemplate action"><button>
> >                                        <img class="@img-url"
> > src="{acti...@img-url}"></img>
> >                                        <div class="@name">{acti...@name
> > }</div></button></li>
> >                        </ul>
> >                </li>
> > </div>
>
> > What's the best way to convert this? Should I iterate through arrays
> > or can I use subtemplates? I tried but with no effect ;)
>
> > Thanks,
> > Robert

Reply via email to