diff --git a/demo/index.php b/demo/index.php new file mode 100644 index 00000000..d23bc85e --- /dev/null +++ b/demo/index.php @@ -0,0 +1,15 @@ +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->spew("./templates/index.tpl"); + + +?> diff --git a/demo/templates/footer.tpl b/demo/templates/footer.tpl new file mode 100644 index 00000000..e04310fd --- /dev/null +++ b/demo/templates/footer.tpl @@ -0,0 +1,2 @@ + + diff --git a/demo/templates/header.tpl b/demo/templates/header.tpl new file mode 100644 index 00000000..d6811312 --- /dev/null +++ b/demo/templates/header.tpl @@ -0,0 +1,3 @@ + + +Monte's title diff --git a/demo/templates/index.tpl b/demo/templates/index.tpl new file mode 100644 index 00000000..ee32a5d7 --- /dev/null +++ b/demo/templates/index.tpl @@ -0,0 +1,63 @@ +{include header.tpl} +{* A simple variable test *} +hello, my name is {$Name}.
+{if $Name eq "Joe"} + I am Joe.
+{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 new file mode 100644 index 00000000..d23bc85e --- /dev/null +++ b/index.php @@ -0,0 +1,15 @@ +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->spew("./templates/index.tpl"); + + +?> diff --git a/templates/footer.tpl b/templates/footer.tpl new file mode 100644 index 00000000..e04310fd --- /dev/null +++ b/templates/footer.tpl @@ -0,0 +1,2 @@ + + diff --git a/templates/header.tpl b/templates/header.tpl new file mode 100644 index 00000000..d6811312 --- /dev/null +++ b/templates/header.tpl @@ -0,0 +1,3 @@ + + +Monte's title diff --git a/templates/index.tpl b/templates/index.tpl new file mode 100644 index 00000000..ee32a5d7 --- /dev/null +++ b/templates/index.tpl @@ -0,0 +1,63 @@ +{include header.tpl} +{* A simple variable test *} +hello, my name is {$Name}.
+{if $Name eq "Joe"} + I am Joe.
+{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}