ibrows /simplecms-bundle
Symfony Simple CMS Bundle
    5.2.2
    2015-10-07 14:07 UTC
Requires
- php: >=5.3.3
- ibrows/simple-seo-bundle: ~1.2
- symfony/framework-bundle: !=2.3.9,~2.2
Suggests
- stfalcon/tinymce-bundle: >=0.3
README
设置Bundle
- 获取源代码
- 将命名空间添加到您的自动加载器
- 将Bundle添加到您的AppKernel类
- 添加路由
- 生成Schema
- 权限
- 享受
如何使用简单CMS
只需在twig文件中添加一个标签,允许用户编辑特定实体类型(默认提供文本和图像)
一些示例
{# add a text with key 'mycustomtextidentifier' #} {{ 'mycustomtextidentifier'|scms('text') }} {# add a image with key 'mycustomimageidentifier' #} {{ scms('mycustomimageidentifier','image') }} {# add a collections of texts with key 'mycustomtextidentifier' #} {{ 'mycustomtextidentifier'|scms_collection('text') }} {# add a collections of images with key 'mycustomimageidentifier' #} {{ scms_collection('mycustomimageidentifier','image') }}
高级示例
带有my类和行内编辑样式(而不是块)的单一图片以及特定区域(默认为当前区域)
{{ scms('mycustomidentifier','image',{'inline':true,'attr':{'class':'mycssclass'} },'de_CH'  ) }}
灵活数量的wysiwyg文本元素
{{ scms_collection('mycustomidentifier','text',{'html':true}) }}
安装和设置Bundle
- 
获取源代码 在composer.json中添加IbrowsSimpleCMSBundle { "require": { "ibrows/simplecms-bundle": "*" } } 现在通过运行以下命令让composer下载Bundle $ php composer.phar update ibrows/simplecms-bundle Composer将Bundle安装到您的项目目录 ibrows/simplecms-bundle。
- 
将Bundle添加到您的 AppKernel类// app/AppKernerl.php public function registerBundles() { $bundles = array( // ... new Ibrows\SimpleCMSBundle\IbrowsSimpleCMSBundle(), // ... ); // ... } 
- 
添加路由 // app/config/routing.yml IbrowsSimpleCMSBundle: resource: "@IbrowsSimpleCMSBundle/Controller/" type: annotation prefix: /scms # use the alias routing IbrowsSimpleCMSBundleAlias: resource: . type: ibrows_router prefix: / 
- 
生成Schema php app/console doctrine:schema:update --force 
- 
权限 获取FileUpload权限,默认文件夹是web-dir uploads/documents
最小配置
此Bundle不需要任何东西!
额外配置
编辑默认配置
# app/config/conf.yml
    ibrows_simple_cms:
      include_js_libs: true
      upload_dir: 'uploads/documents'
      role: ROLE_IS_AUTHENTICATED_ANONYMOUSLY
按类型添加安全
# app/config/conf.yml
    ibrows_simple_cms:
      types:
    # defaults
        text: { class: Ibrows\SimpleCMSBundle\Entity\TextContent , type: Ibrows\SimpleCMSBundle\Form\TextContentType, security:{general: ROLE_ADMIN} }
        image: { class: Ibrows\SimpleCMSBundle\Entity\ImageContent, type: Ibrows\SimpleCMSBundle\Form\FileContentType, security:{general: ROLE_ADMIN, show: ROLE_SUPER_ADMIN, create: ROLE_SUPER_ADMIN , edit: ROLE_SUPER_ADMIN , delete: ROLE_SUPER_ADMIN  } }
编辑TinyMCE选项
# app/config/conf.yml
    ibrows_simple_cms:
      wysiwyg:
        theme: 'advanced'
        theme_advanced_buttons1: 'bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect'
    # other configs...
添加类型
添加/编辑内容类型
# app/config/conf.yml
    ibrows_simple_cms:
      types:
        # defaults
        text: { class: Ibrows\SimpleCMSBundle\Entity\TextContent , type: Ibrows\SimpleCMSBundle\Form\TextContentType }
        image: { class: Ibrows\SimpleCMSBundle\Entity\ImageContent, type: Ibrows\SimpleCMSBundle\Form\FileContentType}
        # custom
        mytext: { class: Ibrows\SimpleCMSBundle\Entity\TextContent , type: Ibrows\SimpleCMSBundle\Form\TextContentType , repository: Ibrows\SimpleCMSBundle\Repository\TextContent, label:first}
        mycustomentity: { class: Ibrows\XXXBundle\Entity\YYYContent , type: Ibrows\SimpleCMSBundle\Form\YYYContentType , repository: Ibrows\SimpleCMSBundle\Repository\Content, label:myone}
您的YYYContent实体必须实现Ibrows\SimpleCMSBundle\Entity\ContentInterface或扩展Ibrows\SimpleCMSBundle\Entity\Content或其子类。在您的FormType中扩展Ibrows\SimpleCMSBundle\ContentType也是一个好主意。
截图
待办事项
- 创建ODM版本
作者
在iBROWS GmbH Zurich开发:Marc Steiner Dominik Zogg Olivier Kofler
Twitter: @iBRWOSWEB 网站: www.ibrows.ch