Created
July 4, 2013 13:20
-
-
Save adoueb/5927666 to your computer and use it in GitHub Desktop.
Template logic Template logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Template logic", | |
"description": "Template logic", | |
"data": { | |
"people": [ | |
{ | |
"name": "Omer", | |
"age": 38 | |
}, | |
{ | |
"name": "Marge", | |
"age": 38 | |
}, | |
{ | |
"name": "Bart", | |
"age": 10 | |
}, | |
{ | |
"name": "Lisa", | |
"age": 8 | |
}, | |
{ | |
"name": "Maggie", | |
"age": 1 | |
} | |
] | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{macro main()} | |
<div class="mainlist"> | |
{foreach person inArray data.people} | |
{if person.name == "Bart"} | |
{call helloDiv(person, "bart")/} | |
{else /} | |
{call helloDiv(person, "person")/} | |
{/if} | |
{/foreach} | |
<span class="footnote">(${data.people.length} people in the list)</span> | |
</div> | |
{/macro} | |
{macro helloDiv(person, cssClass)} | |
<div class="${cssClass}">Hello ${person.name}</div> | |
{/macro} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
$classpath:'InstantTemplateScript', | |
$prototype : { | |
myMethod: function() { | |
} | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{macro main()} | |
.bart { | |
color: blue; | |
font-size: 1.4em; | |
} | |
.footnote { | |
font-style: italic; | |
font-size: 0.8em; | |
color: grey; | |
} | |
{/macro} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created by Instant Aria Templates, viewable on http://instant.ariatemplates.com/adoueb/5927666