This article mainly introduces the method of Smarty simple form elements, involving the Smarty template file operation of the relevant skills, the need for friends can refer to. We hope to help you.
Specific as follows:
Smarty the ability to generate form elements is implemented by giving Smarty an array for generating and displaying menus or options, and also for passing an option value for the default selection of matches:
Examples are as follows:
PHP File: index.php
<?php include ("smarty_inc.php"), $smarty->assign (' Cust_ids ', Array (1000,1001,1002,1003)); $smarty->assign (' Cust_names ', Array (' Dingqing ', ' Len Lei ', ' lvdong ', ' Song Zijian ')), $smarty->assign (' customer_id ', 1003); $smarty->display (" Index.html ");? >
Template file: index.html
<select name=customer_id onkeypress= "" ><{html_options values= $cust _ids selected= $customer _id output= $cust _ NAMES}></SELECT><HR/><{html_radios name= "id" values= $cust _ids selected= $customer _id output= $cust _names}>
Related recommendations:
Smarty template engine Video teaching materials course recommendation
How PHP built-in functions are shared by instances invoked in Smarty
What are the PHP smarty template operators? How is the operator used?