html_image function

html_image function

basedir is the base path of the relative image path. If this attribute is not given, it will be based on the root path of the WEB server (environment variable DOCUMENT_ROOT) shall prevail. If the template's security settings are turned on, the location of the image must be in a secure folder.

href is the location where the image link points. If this attribute is set, hyperlink tags will be added to both sides of the image to form an image link.

Technical points: html_image needs to access the disk to obtain the size of the image. If buffering is not used, in order to optimize performance, it is generally recommended to use static image tags and avoid using html_iamge.

eg:

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:




Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!