Home > Backend Development > PHP Tutorial > Usage examples of smarty custom function htmlcheckboxes, smarty custom function_PHP tutorial

Usage examples of smarty custom function htmlcheckboxes, smarty custom function_PHP tutorial

WBOY
Release: 2016-07-13 10:09:14
Original
993 people have browsed it

smarty custom function htmlcheckboxes usage example, smarty custom function

The example in this article describes the usage of smarty custom function htmlcheckboxes. Share it with everyone for your reference. The details are as follows:

Access file: index.php:

Copy code The code is as follows:
require_once('libs/Smarty.class.php');
$smarty = new Smarty();
$smarty->setTemplateDir($_SERVER['DOCUMENT_ROOT']."/php/templates/");
$smarty->setCompileDir($_SERVER['DOCUMENT_ROOT']."/php/templates_c/");
$smarty->setCacheDir($_SERVER['DOCUMENT_ROOT']."/php/cache/");
$smarty->caching = false;

$smarty->assign('cust_ids',array(1000,1001,1002,1003));
$smarty->assign('cust_name',array("Xi Yang Yang","美 Yang Yang","Lazy Yang","Ha Ha Ha"));
$smarty->assign('customer_id',1001);

$smarty->display("temp.htm");
?>


Template file: temp.htm
Copy code The code is as follows:
{html_checkboxes values=$cust_ids output=$cust_name selected=$customer_id}

Test results: The display is normal under UTF-8, but when the file encoding is ANSI, Chinese cannot be displayed.

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/946759.htmlTechArticlesmarty custom function htmlcheckboxes usage example, smarty custom function This article describes the usage of smarty custom function htmlcheckboxes. Share it with everyone for your reference. The details are as follows...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template