Howdy.
Currently the subtemplates feature is only available in one branch.
I haven’t been able to test it much or document it properly yet.
The rest of the functionality is very stable.
— Thomas Aylott
SubtleGradient
MooTools
On Feb 7, 2010, at 5:23 AM, Robert 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