technikh/sculpin-path-navigation-bundle-v1

在Sculpin中生成路径导航块(包含页面)

安装: 10

依赖者: 0

建议者: 0

安全: 0

星星: 0

关注者: 1

分支: 2

类型:sculpin-bundle

1.0.1 2016-11-03 15:39 UTC

This package is not auto-updated.

Last update: 2024-09-23 12:48:06 UTC


README

在Sculpin中生成日期导航块(包含页面)

  • 它生成列出每年和每对年/月文章的页面
  • 以及一个用于在这些页面之间导航的块

您可以在我的个人法语博客的右侧列中看到一个工作演示。

安装

使用composer,将依赖项添加到您的composer.json文件中

require: {
    "jbouzekri/sculpin-date-navigation-bundle": "1.*"
}

然后运行composer update命令

启用该捆绑包。如果您已经有了app/SculpinKernel.php文件,请将此捆绑包添加到其中,否则创建一个具有以下内容的文件

<?php

class SculpinKernel extends \Sculpin\Bundle\SculpinBundle\HttpKernel\AbstractKernel
{
    protected function getAdditionalSculpinBundles()
    {
        return array(
            'Tn\Bundle\PathNavigationBundle\TnPathNavigationBundle'
        );
    }
}

然后您需要将日期页面HTML和日期导航块HTML添加到您的项目中

  • 将Resources/html/include/path_navigation.html文件复制到您的源文件中的_includes文件夹
  • 将Resources/html/page/date.html文件复制到您的源文件中的博客文件夹(或您使用的任何其他HTML文件夹)。信息提示:path_paginated.html模板可用于分页日期页面。

用法

在模板中,您现在可以调用以下twig函数

{{ path_navigation(page) }}

它将生成日期导航HTML。

您可以指定自定义模板

{{ tag_cloud(page, 'my_template.html') }}

配置

tn_path_navigation:
    permalink_year: /:year/index.html
    permalink_month: /:year/:month/index.html
  • tn_path_navigation.permalink_year:日期页面URL掩码
  • tn_path_navigation.permalink_month:日期月份页面URL掩码

许可证

MIT