【发布时间】:2014-10-06 17:42:02
【问题描述】:
我正在为我最近的个人项目使用 smarty,但遇到了问题。
$smarty = new Smarty;
$smarty->template_dir = 'templates/dashboard/';
上面可以从这个目录加载 .tpl 文件,这对我很有用,但是在 .tpl 里面我想加载一个图像,我必须这样做:
<img src="templates/dashboard/images/avatar/full/{$user->username}.jpg" class="profile-avatar img-thumbnail">
我想做但不会工作的是:
<img src="images/avatar/full/{$user->username}.jpg" class="profile-avatar img-thumbnail">
当我设置 template_dir 时,我觉得这也会改变,但它不会...... 我找不到任何可以更改 .tpl 文件的文档。
注意“模板/仪表板”,这就是我想在 .tpl 中删除的内容
【问题讨论】: