php—Smarty-6 (23),phpsmarty-623
接上一篇
10、html_options 打印一组option 用于 select元素
{html_options values=$cust_ids selected=$customer_id output=$cust_names}
Values:值的数组
Output:文本的数组
Selected:被选中项的值
11、html_radios 打印一组单选按钮
语法:
{html_radios values=$cust_ids checked=$customer_id output=$cust_names separator="
"}
Values:值的数组
Output:文本的数组
Separator:分隔符
Checked:被选项中的值
三、 配置文件
配置文件有利于设计者管理文件中的模板全局变量。最简单的例子就是模板色彩变量。一般情况下你如果想改变一个程序的外观色彩,你就必须通过去更改每一个文件的颜色变量。如果有这个配置文件的话,色彩变量就可以保存在一个地方,只要改变这个配置文件就可以实现你色彩的更新。
程序设计
一、 常量
SMARTY_DIR
二、 变量
l $template_dir :模板路径
l $compile_dir :编译路径
l $config_dir :配置文件路径
l $cache_dir :缓存文件路径
l $left_delimiter :左分隔符
l $right_delimiter :右分隔符
l $caching :是否开启缓存
public $caching = false;
默认是开闭缓存的,可以直接设置为true,开启缓存功能
l $cache_lifetime :缓存的有效时间(生命周期)
public $cache_lifetime = 3600;
默认是3600秒,
l $debugging 开启调试窗口
开启调试窗口共有两种方式:
1)在模板中,使用{debug}
2)在程序中,使用$smarty->debugging=true
程序中开启:可以看到为模板分配的变量
模板中开启:为模板分配的变量,模板自定义的变量
l $php_handling :在smarty2.6中,如果想使用{php}标记,必须将此选项的值设置为true

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools