href
是图象链接指向的位置. 如果设置了该属性,图象两侧将被加上超级链接标签,形成一个图象链接.
Technical Note: html_image requires a hit to the disk to read the image and calculate the height
and width. If you don't use template caching, it is generally better to
avoid html_image and leave image tags static for optimal performance.
技术要点: html_image 需要访问磁盘以获取图象的尺寸. 如果不使用缓冲,为了优化性能,一般情况下建议使用静态图象标签而避免使用
html_iamge.
Example 8-7. html_image
例 8-7. html_image 函数演示
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" />
|
|