Blogroll

photoshop cs6 html 5 css php seo backlinks

adsense

Monday, 24 February 2014

Basics That You Must Know About Smarty Template

Smarty Template Step By Step Tutorial - Part 4: All command at Smarty is in delimeter {}. Now, we will see something basic at Smarty. You must know about them.
Comment
Comment is statements that added at code to explain any or to give note. In Smarty we can use such as:
1<Body>
2{* this template use Smarty! *}
3{* put any code at here! *}
4</Body>
Method
Such as other classes, Smarty have methods. We can use smarty method to help our job. I just want to show a little and we will talk later.
1<Body>
2{config_load file="colors.conf"}
3{include file="header.tpl"}
4{if $somebody}
5 Wellcome, {$name}
6{else}
7 Who are you?!?
8{/if}
9</Body>
Attribute
Such as HTML, in Smarty tag/command can have attribute. Example:
1<Body>
2{include file="footer.tpl"}
3</Body>
Variable
1<Body>
2{func var="test $foo test"}
3{func var="test $foo_bar test"}
4{func var="test $foo[0] test"}
5{func var="test $foo[bar] test"}
6{func var="test $foo.bar test"}
7{func var="test `$foo.bar` test"}
8</Body>
Mathematic

1<Body>
2{$foo * $bar}
3{$foo + $bar}
4</Body>

0 comments:

Post a Comment