douba3378 2011-02-26 14:28
浏览 54
已采纳

更改仅用于css文件的Smarty分隔符标记?

I want to use Smarty to render my CSS file, mainly so I can use a variable for the location of images. In order to avoid errors I need to either user {literal} tags around everything or else change the delimiter so { and } are not Smarty tags.

My question, is it possible to only have that one file use something different for the Smarty tags? If so, how?

Thank you

  • 写回答

1条回答 默认 最新

  • douzen1880 2011-02-26 14:32
    关注

    Not an answer to your question, but one popular method of doing this is having style sheets and images in neighbouring directories, and referencing them using relative ../images references.

    If that is not an option - I don't think you can control delimiters on a per-file basis in Smarty. You can however change the delimiter before the template is parsed:

    $t = new Smarty;
    $t->left_delimiter = '<!--{';
    $t->right_delimiter = '}-->';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集