diff --git a/demo/index.php b/demo/index.php index d23bc85e..68710dad 100644 --- a/demo/index.php +++ b/demo/index.php @@ -7,9 +7,11 @@ $smarty = new Smarty; $smarty->assign("Name","Fred"); $smarty->assign("FirstName",array("John","Mary","James","Henry")); $smarty->assign("LastName",array("Doe","Smith","Johnson","Case")); -$smarty->assign("Class",array("A","B","C","D")); +$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"), + array("I", "J", "K", "L"), array("M", "N", "O", "P"))); $smarty->spew("./templates/index.tpl"); +print "\ndone\n"; ?> diff --git a/demo/templates/index.tpl b/demo/templates/index.tpl index ee32a5d7..e1e47fe2 100644 --- a/demo/templates/index.tpl +++ b/demo/templates/index.tpl @@ -1,63 +1,11 @@ {include header.tpl} + {* A simple variable test *} hello, my name is {$Name}.
{if $Name eq "Joe"} - I am Joe.
+ I am {ldelim}Joe{rdelim}.
{else} I am not Joe.
{/if} -

-Lets loop through some information:
-{section name="outside" $FirstName} - current name is {$outside.LastName}, {$outside.FirstName}
- {section name=inside $Class} - current class is: {$inside.Class}
- {/section} - {if $outside.rownum.even} - row is even
- {else} - row is odd
- {/if} - {if $outside.rownum.mod.2} - row is evenly divisible by 2
- {else} - row is not evenly divisible by 2
- {/if} - {if $outside.rownum.even.2} - row is even, grouped by 2
- {else} - row is odd, grouped by 2
- {/if} -

-{/section} - -{section name=blah $loopvar2} - test default: {htmlesc $blah.loopvar2}
- a free standing section.
-{/section} - -By default, php code is escaped:
- -

-{* the config function at work *} -

- -{configload "config/index.conf"} -config var title: {configprint "title"}
-config var Name: {configprint "Name"}
-{configset "Name", $test} -test is {htmlesc $test}
-{configclear} -

-The following text is {htmlesc ""}.
-{* This is a template comment *} -

-{strip} - All data within the
- {ldelim}strip{rdelim} tags is stripped
- of unneeded tabs, spaces and carriage returns
- at the beginning and end of lines
- in the html source (view this source)
-{/strip} {include footer.tpl} diff --git a/index.php b/index.php index d23bc85e..68710dad 100644 --- a/index.php +++ b/index.php @@ -7,9 +7,11 @@ $smarty = new Smarty; $smarty->assign("Name","Fred"); $smarty->assign("FirstName",array("John","Mary","James","Henry")); $smarty->assign("LastName",array("Doe","Smith","Johnson","Case")); -$smarty->assign("Class",array("A","B","C","D")); +$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"), + array("I", "J", "K", "L"), array("M", "N", "O", "P"))); $smarty->spew("./templates/index.tpl"); +print "\ndone\n"; ?> diff --git a/templates/index.tpl b/templates/index.tpl index ee32a5d7..e1e47fe2 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -1,63 +1,11 @@ {include header.tpl} + {* A simple variable test *} hello, my name is {$Name}.
{if $Name eq "Joe"} - I am Joe.
+ I am {ldelim}Joe{rdelim}.
{else} I am not Joe.
{/if} -

-Lets loop through some information:
-{section name="outside" $FirstName} - current name is {$outside.LastName}, {$outside.FirstName}
- {section name=inside $Class} - current class is: {$inside.Class}
- {/section} - {if $outside.rownum.even} - row is even
- {else} - row is odd
- {/if} - {if $outside.rownum.mod.2} - row is evenly divisible by 2
- {else} - row is not evenly divisible by 2
- {/if} - {if $outside.rownum.even.2} - row is even, grouped by 2
- {else} - row is odd, grouped by 2
- {/if} -

-{/section} - -{section name=blah $loopvar2} - test default: {htmlesc $blah.loopvar2}
- a free standing section.
-{/section} - -By default, php code is escaped:
- -

-{* the config function at work *} -

- -{configload "config/index.conf"} -config var title: {configprint "title"}
-config var Name: {configprint "Name"}
-{configset "Name", $test} -test is {htmlesc $test}
-{configclear} -

-The following text is {htmlesc ""}.
-{* This is a template comment *} -

-{strip} - All data within the
- {ldelim}strip{rdelim} tags is stripped
- of unneeded tabs, spaces and carriage returns
- at the beginning and end of lines
- in the html source (view this source)
-{/strip} {include footer.tpl}