继续Drupal分享精神 QQ群:107748121 站长QQ:532116351【drupal交流+drupal 建站+theme制作】
登录 注册

使用drupal $base_path 和 $directory变量 打印出文件或图片路径

base_path() 返回安装路径
$directory 返回目录

如果自己做drupal theme的时候。
比如theme所在路径为
sites/all/themes/hellodrupal
图片放在sites/all/themes/hellodrupal/images里面
如sites/all/themes/hellodrupal/images/logo.png

那在page.tpl.php 可以使用这样方法打印出logo.png图片

<div id="logo"><img src="<?php print $base_path.$directory?>/images/logo.png" alt=""/></div>

参考base_path api http://api.drupal.org/api/function/base_path/6;

评论

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 自动断行和分段。
  • You can use BBCode tags in the text.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.