it-blaster / content-bundle
Symfony2内容管理bundle,需要Propel、Sonata和jstree
v1.0.3
2015-06-30 13:17 UTC
Requires
- egeloen/ckeditor-bundle: >=2.0
- it-blaster/translation-bundle: >=1.0.0
- propel/propel-bundle: >=1.0
- sonata-project/propel-admin-bundle: >=1.0
- symfony/symfony: >=2.2
This package is not auto-updated.
Last update: 2024-09-14 17:00:50 UTC
README
安装
添加到composer.json
并安装
{ "require": { "it-blaster/content-bundle": "dev-master" }, }
添加bundle到AppKernel.php
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Etfostra\ContentBundle\EtfostraContentBundle(), ); }
添加到routing.yml
EtfostraContentBundle: resource: . type: extra
构建模型,运行SQL并安装资源
$ php app/console propel:model:build $ php app/console propel:migration:generate-diff $ php app/console propel:migration:migrate $ php app/console assets:install
要启用SonataAdmin中的标签翻译
framework: translator: { fallbacks: ["%locale%"] }
配置
编辑你的config.yml
,添加etfostra_content
etfostra_content: page_controller_name: EtfostraContentBundle:PageFront:page page_template_name: EtfostraContentBundle:Front:default.html.twig module_route_groups: # optional, modules (routes groups) - { name: News, routes: @AcmeAppBundle/Resources/config/routing_news.yml } - { name: Catalog, routes: @AcmeAppBundle/Resources/config/routing_catalog.yml }
调试路由
$ php app/console debug:router
Twig函数
通过路由名称获取链接
{{ page_path('etfostra_content_56') }}
此函数通过“路由名称”返回页面链接,你可以从页面编辑表单中复制它。函数在找不到路由时防止异常。
通过slug获取链接
{{ page_path_by_slug('any-page-slug') }}
生成额外的查询!此函数通过Slug返回页面链接,你可以在页面编辑表单中编辑和复制它。函数在找不到路由时防止异常。