Drupal - 页面 PHP 打印图像正常,除非在管理/某些用户页面上
这是我在 page.tpl.php 中使用的代码:
<div id="beforefooter">
<?php print l('<img src="imagesmy/logo.jpg" />', '<front>', array('html' => TRUE)); ?>
</div>
<div id="afterfooter">
<a href="http://www.site.com" target="_blank" >
<img src="imagesmy/credit.jpg" />
</a>
</div>
对于大多数页面,这工作正常,但在管理页面上时,图像不会显示。此外,在某些用户页面(您需要注册才能查看)上,图像也不会显示。
从页面上的源代码来看,它工作和不工作时似乎是相同的。
谢谢
Here is the code ive been using in my page.tpl.php:
<div id="beforefooter">
<?php print l('<img src="imagesmy/logo.jpg" />', '<front>', array('html' => TRUE)); ?>
</div>
<div id="afterfooter">
<a href="http://www.site.com" target="_blank" >
<img src="imagesmy/credit.jpg" />
</a>
</div>
For most pages this works fine, but when on an admin page the images dont show up. Also on certain user pages (that you need to be registered to see) the images also dont show up.
From looking at the source code on the page it seems identical when it does and doesnt work.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用
base_path()
或$base_path
print l(' ;', '', array('html' => TRUE));
不同页面上图像的路径是否完全相同?我看到了一个类似的问题,它试图在“www.example.com/admin/imagesmy/logo.jpg 而不是在文档根目录中查找图像
Try using
base_path()
or$base_path
print l('<img src="' . base_path() . 'imagesmy/logo.jpg" />', '<front>', array('html' => TRUE));
Are the paths to the image exactly the same on the different pages? I saw a similar problem where it was trying to find the image at "www.example.com/admin/imagesmy/logo.jpg instead of in the document root
您还可以尝试使用
drupal_get_path()
构建图像,它一定会解析到图像的正确位置。You could also try constructing your image using
drupal_get_path()
and it would be sure to resolve to the correct location for the image.