smarty模版中使用图片的路径问题

http://www.speedphp.com/bbs/thread-85-1-1.html
说show.htm在运行的时候其实是根tpl同级目录的

1、 在index.php中:
define("BASEPATH","/app1/tpl/");
然后在show.htm中:
<img src="{$smarty.const.BASEPATH}images/1.jpg" />就OK了
2、 其实这个问题论坛里已经讨论过了,楼上的不错,不过如果每一个图片都要这样写,有点麻烦了,
推荐在模板中使用<base href=""/>属性,一次书写,可以全盘解决。

原文地址:https://www.cnblogs.com/carl2380/p/2514988.html