douqu8828 2013-07-24 08:05
浏览 9

使用phpHaml或PhamlP - 非常困惑如何做到这一点

I am trying to write my first wordpress theme, and I am using haml but I stumbled into a problem when I want to write statements such as the following, but in haml

<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/reset.css" type="text/css">

I thought the haml equivalent would simply use a :plain tag for the php but then I realised this would quickly turn very ugly, and it didn't much work.

So I am stuck with this:

%link{ :rel => "stylesheet", :href => "<?php bloginfo('stylesheet_directory'); ?>" }

Which, of course, is wrong.

I have had a look at phpHaml and PhamlP but I have no idea how to use them for my need of using a php statement inside a :href attribute in haml.

I am using CodeKit to recompile haml into php by simply changing the extension it compiles to from .html to .php and a lot of the documentation, to my understanding, requires I import their files in another .php file to use their parsers.

Is there any way to achieve what I want to do?

Basically using php inline with haml, as easily as possible.

  • 写回答

2条回答 默认 最新

  • dongxianghuan3587 2013-08-29 11:00
    关注

    There is a way - the kind folks at WeLaika have created a plugin for wordpress called Wordless

    It does exactly what you are asking (to use php inline with haml) as it is bundled with the phaml parser.

    It requires a working ruby environment (using rvm) on your machine, and then you can write using ruby style "layouts and views" templates. It also allows for the use of SASS/SCSS in your stylesheets and Coffescript for your Javascript. But these are, of course, optional.

    I also recommend using the two gems, Wordmove and Wordless_Gem

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?