使用PHP/Smarty模板的文件路径


file path using PHP/Smarty Templates

我有一个使用SMarty模板(我没有创建)的PHP网站。下面的代码在view_video.tpl中用于生成一个按钮,该按钮带有一个附加到onclick操作的函数。

<div class="user-button" id="user-button-up">
    <a href="javascript:void();" onclick="video_description_toggle()">
        <img height="16" width="16" src="images/user-arrow.jpg">
    </a>
</div>
<div class="user-button" id="user-button-down" style="display:none;">
    <a href="javascript:void();" onclick="video_description_toggle()">
        <img height="16" width="16" src="images/user-arrow-down.jpg">
    </a>
</div>

我注意到这些按钮没有显示在页面上,所以我通过Pindom(tools.Pingdom.com)运行页面,它分解了页面的每个元素以及加载所需的时间等。在页面结果中,两个图像(user-arrow.jpg和user-arrow down.jpg)显示的文件路径为:sitename.com/video/41137/images/
其他图像都没有这个错误的文件路径,只有这两个。

当我从浏览器中查看页面的来源时,它显示:

<div class="user-button" id="user-button-up">
    <a href="javascript:void();" onclick="video_description_toggle()">
        <img height="16" width="16" src="images/user-arrow.jpg">
    </a>
</div>
<div class="user-button" id="user-button-down" style="display:none;">
    <a href="javascript:void();" onclick="video_description_toggle()">
        <img height="16" width="16" src="images/user-arrow-down.jpg">
    </a>
</div>

在视频/目录中只有视频,没有带数字的文件夹(或其中有图像目录)。。。我相信,对于任何有PHP模板使用经验的人来说,这应该很容易(但我还不是)。

谢谢。

img中的路径是相对于显示的url的,而不是模板存储的位置,因此如果您在sitename.com/video/41137/中,它将在此处查找images文件夹,除非您在"images"之前添加斜线或"../../"