是否可以将 Symfony 2.3.* twig 与 haml 结合使用?

Is it posible to combine inside Symfony 2.3.* twig with haml?

我想知道是否有将 twig 与 haml 结合用于 symfony2 视图的解决方法。

This is Haml http://haml.info/ (This is for Ruby On Rails) 基本上就是用这个:

%section.container
  %h1= post.title
  %h2= post.subtitle
  .content
    = post.content

而不是这个:

<section class=”container”>
  <h1><%= post.title %></h1>
  <h2><%= post.subtitle %></h2>
  <div class=”content”>
    <%= post.content %>
  </div>
</section>

这是 php https://code.google.com/p/phamlp/ 的版本,但我想知道我是否可以在 Symfony 2 中使用它

你试过arnaud-lb/MtHamlBundle了吗?

根据README,它可以混合Twig和Haml模板。

备注: 该捆绑包似乎锁定在 Symfony 2.1 上,并且可能存在不必要的依赖项。您可以 fork 存储库并尝试更改 version in composer.json. To understand how to install forked bundle, you can watch read the answers of this Whosebug question。如果可行,请考虑向存储库发送拉取请求。