tsphethean/sculpin-related-posts-bundle

0.1.0 2014-03-21 14:38 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:52:45 UTC


README

创建显示与 Sculpin 驱动的站点匹配的标签的源代码块。

设置

将此包添加到您的 sculpin.json 文件中

{
    // ...
    "require": {
        // ...
        "tsphethean/sculpin-related-posts-bundle": "~0.1.0"
    }
}

然后运行 sculpin update 安装此包。

现在您可以在 app/SculpinKernel.php 文件中找到的 SculpinKernel 类中注册此包

class SculpinKernel extends \Sculpin\Bundle\SculpinBundle\HttpKernel\AbstractKernel
{
    protected function getAdditionalSculpinBundles()
    {
        return array(
           'Tsphethean\Sculpin\Bundle\RelatedPostsBundle\SculpinRelatedPostsBundle'
        );
    }
}

如何使用

在您的模板中

{% if page.related %}
<ul>
  {% for relate in page.related %}
  <li><a href="{{ relate.source.url }}">{{ relate.title }}</a></li>
  {% endfor %}
</ul>
{% endif %}