0

更新到 Symfony 2.6 后,使用 kn._paginator 的页面不再加载:

An exception has been thrown during the rendering of a template 
("Warning: file_get_contents(/Users/steve/dev/sites/virtual/newgt/
vendor/knplabs/knp-paginator-bundle/Knp/Bundle/PaginatorBundle/Resources/views
/Pagination/sliding.html.twig): 
failed to open stream: No such file or directory") in
NewgtMediaBundle:Default:showSeriesSeason.html.twig at line 32


Config.yml ::
# KNP Paginator
knp_paginator:
    page_range: 5                      # default page range used in pagination control
    default_options:
        page_name: page                # page query parameter name
        sort_field_name: sort          # sort field query parameter name
        sort_direction_name: direction # sort direction query parameter name
        distinct: true                 # ensure distinct results, useful when ORM queries are using GROUP BY statements
    template:
        pagination: KnpPaginatorBundle:Pagination:sliding.html.twig     # sliding pagination controls template
        sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig # sort link template

请求的模板:

/Users/steve/dev/sites/virtual/newgt/vendor/knplabs/knp-paginator-bundle/Knp/Bundle/PaginatorBundle/Resources/views/Pagination/sliding.html.twig 

实际存在于:

/Users/steve/dev/sites/virtual/newgt/vendor/knplabs/knp-paginator-bundle/Resources/views/Pagination/sliding.html.twig

如何告诉我的应用程序 knp_paginator 应该在哪里寻找模板?

4

1 回答 1

1

更新 config.yml

knp_paginator:
....
    template:
        # Following two lines were present before Symfony 2.6 upgrade. 
        # Commented out to load from default location.
        # pagination: KnpPaginatorBundle:Pagination:sliding.html.twig     # sliding pagination
        # sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig # sort link template

然后

sudo rm -rf app/cache/prod 
app/console cache:clear –env=prod

(与 --env=dev 相同)

http: //mysite/app_dev.php/media/gallery/24223
?page=5&count=82&number=1752&series=FIAGT&season=2009http://mysite/media/gallery/24223?page=5&count=82&number=1752&series=FIAGT&season =2009

又开始工作了。

于 2015-03-01T14:33:01.613 回答