Location: PHPKode > projects > Vemplator > example/example.template.html
<h1>If/Else Statements - True</h1>
<p>
	Value of <em>ifTest</em>: <strong>{ifTest}</strong><br />
	{if:ifTest}
		<em>ifTest</em> evaluated to non-false
	{else}
		<em>ifTest</em> evaluated to false
	{end}
</p>

<h1>If/Else Statements - False</h1>
<p>
	Value of <em>ifTest2</em>: <strong>{ifTest2}</strong><br />
	{if:ifTest2}
		ifTest evaluated to non-false
	{else}
		ifTest evaluated to false
	{end}
</p>

<h1>Switch Statement</h1>
<p>
	Value of <em>switchTest</em>: {switchTest}</em><br />
	Value of <em>other</em>: {other}</em><br />
	{switch:switchTest}
		Default case
	
	{case:other}
		<em>switchTest</em> was equal to <em>other</em><br />
		Value of <em>other</em>: {other}
	
	{case:'vemplator'}
		<em>switchTest</em> variable was vemplator
	{endswitch}
</p>

<h1>Loops</h1>
<p>
	<em>Loop over items, showing index and value</em>
	{foreach:rows,i,row}
		<br />#{i} = {row['name']}
	{end}
	
	<br /><br /><em>Loop over items, showing only value</em>
	{foreach:rows,row}
		<br />{row['name']}
	{end}
</p>

<h1>Accessing Arrays</h1>
<p>
	<em>Simple</em><br />
	rows[0]['name'] = {rows[0]['name']}<br /><br />
	
	<em>Making use of a Function</em><br />
	ucwords(rows[1]['name'] = {ucwords(rows[1]['name'])}<br /><br />
</p>

<h1>Accessing Objects</h1>
<p>
	<em>Member Variables</em><br />
	obj.names['first'] = {obj.names['first']}<br />
	obj.names['last'] = {obj.names['last']}<br /><br />
	
	<em>Methods</em><br />
	obj.fullName() = {obj.fullName()}
</p>

<h1>Both</h1>
<p>
	rows[0][keys.a.a] = {rows[0][keys.a.a]}
</p>
Return current item: Vemplator