Aug 31, 2012 - linux    No Comments

Enable php short tag

作为一个前端页面仔,在drupal项目里最常用到的一段代码就是:

<?php
global $base_url;
$root = $base_url . '/' . path_to_theme() . '/';
?>

然后在tpl模板里就可以这样输出图片了:

<img src="<?php echo $root; ?>images/footer-nav6.gif" />

当然php的简写就更方便了:

<img src="<?= $root; ?>images/footer-nav6.gif" />

但这是需要服务器支持的,一般服务器默认这个选项是没有打开的,当然xampp之流除外。

于是又摸了一次服务器:
(先去根目录这种多余步骤,纯粹是个人不良癖好)

随便还开了一个这个,好像是用在把文字生成为一张图片上的:

Got anything to say? Go ahead and leave a comment!