This example describes the common code snippet for smarty. Share to everyone for your reference, specific as follows:
1,
<select >
{html_options values= $cust _ids selected= $customer _id output= $cust _names}
</select>
Description: Generate a Drop-down menu. Values= an array in which the array element selected= a value for the list value, which is the default column
Table value output= An array with the array element as the displayed list value
{html_checkboxes values= $cust _ids checked= $customer _id output= $cust _names separator=
"<br/>"}
Description: check box. Ibid. separator= "<br/>" refers to a string that separates each check button by <br/>
{Html_radios values= $cust _ids checked= $customer _id output= $cust _names separator=
"<br/>"}
Description: Radio button
2,
{Counter start=0 skip=2 print=ture}
Description: Counter, after use, start with 0, increase by 2 each time.
3,
{section loop= $data}
<tr bgcolor= "{cycle values=" #eeeeee, #d0d0d0 "}" >
<td>{$data [rows]}</td>
</tr>
{/section}
Description: Return the array element (or a series) value in Samsara
4,
{Assign var= ' name ' value= ' Bob '}
The value of $name is {$name}.//the value of $name is Bob.
Description: Assigning values
5,
{Fetch file= "http://www.myweather.com/68502/" assign= "Weather"}
Description: Fetch is used to get files from the local file system, HTTP, or FTP and to display the contents of the file. If the file name
Starting with "http://", the site page is obtained and displayed. If the file name starts with "ftp://", it will be obtained from the FTP server
The file and display it.
6,
{Html_image file= ". /path/relative/to/currdir/pumpkin.jpg "
border=" "1" height= "width=" alt= "Picture" href= "1.html"}
Description: Picture
7,
Description: Create date drop down menu. It can show any date
Description: Used to create a time drop-down menu. It can display any time and seconds
8,
{html_table loop= $data cols=4 table_attr= ' border= ' 0 "'
tr_attr= $tr td_attr= $TD}
Description: Forms a 4-column table with $data array elements. Table_attl is a table property, Tr_attr is a row property, Td_attr
As Column Properties
9,
{Math equation= "x + y" x= $height y= $width}
Description: Mathematical operation function
10,
{mailto address= "me@domain.com" text= "Send me some Mail"}
Description: Generate Email links
11,
Description: Create a JavaScript pop-up window, you must first call the Popup_init function before use
I hope this article will help you with the PHP program design based on Smarty template.