This article illustrates the mathematical operational usage of the Smarty template. Share to everyone for your reference, specific as follows:
{* $height =4, $width =5 *}
{Math equation= "x + y" x= $height y= $width}
Output:
9
{* $row _height = ten, $row _width = #col_div # = 2, assigned in template *}
{Math equation= "Height * width/division"
height= $row _height
width= $row _width division=
#col_div #}
Output:
100
{* Can use parenthesis *}
{Math equation= "((x + y)/z)" X=2 y=10 z=2}
Output:
6
{* You can supply a format parameter in sprintf format *}
{Math equation= "x + y" x=4.4444 y=5.0000 format= "%.2f"}
Output:
9.44
Through which they can do some mathematical arithmetic!
More interested in smarty related content readers can view the site topics: "Smarty Template Primer Tutorial", "PHP Template Technology Summary", "PHP based on PDO Operation Database Skills summary", "PHP Operations and Operator Usage Summary", "PHP Network Programming Skills Summary", " Introduction to PHP Basic Grammar, "Introduction to PHP object-oriented programming", "PHP string (String) Usage Summary", "Php+mysql Database Operations Tutorial" and "PHP common database Operation Skills Summary"
I hope this article will help you with the PHP program design based on Smarty template.