更新到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_pageator应该在哪里查找模板?
更新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&计数=82&数字=1752&series=FIAGT&季节=2009和http://mysite/media/gallery/24223?page=5&计数=82&数字=1752&series=FIAGT&季节=2009
正在重新工作。