Smarty Learning notes Common code Snippet Usage Summary _php instance

Source: Internet
Author: User
Tags time and seconds smarty template

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,

{Html_select_date}

Description: Create date drop down menu. It can show any date

{Html_select_time}

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,

{Popup}

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.