html_image

PHP Smarty

Smarty - the compiling PHP template engine
Smarty - php 模板编译引擎
Prev 来源:PHP中文社区 Chapter 8. Custom Functions[第八章.自定义函数] Next

html_image

Attribute Name Type Required Default Description
file string Yes n/a name/path to image
border string No 0 size of border around image
height string No actual image height height to display image
width string No actual image width width to display image
basedir string no web server doc root directory to base relative paths from
alt string no "" alternative description of the image
href string no n/a href value to link the image to

属性 类型 是否必须 缺省值 描述
file string Yes n/a 图象文件的名称或路径
border string No 0 图象边框大小
height string No actual image height 显示图象高度
width string No actual image width 显示图象宽度
basedir string no web server doc root 图象文件位置的相对路径
alt string no "" 可选图象描述(鼠标指向图象或图象文件不存在时显示的字符串信息)
href string no n/a 图象链接到的地址
index.php:

require('Smarty.class.php');
$smarty = new Smarty;
$smarty->display('index.tpl');

index.tpl:

{html_image file="pumpkin.jpg"}
{html_image file="/path/from/docroot/pumpkin.jpg"}
{html_image file="../path/relative/to/currdir/pumpkin.jpg"}

OUTPUT: (possible)

<img src="pumpkin.jpg" alt="" border="0" width="44" height="68" />
<img src="/path/from/docroot/pumpkin.jpg" alt="" border="0" width="44" height="68" />
<img src="../path/relative/to/currdir/pumpkin.jpg" alt="" border="0" width="44" height="68" />

Prev 来源:PHP中文社区 Home Next
html_checkboxes Up html_options