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

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

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