mssimi/content-management-bundle

简单内容管理系统

dev-master / 0.1.x-dev 2018-06-13 10:45 UTC

This package is auto-updated.

Last update: 2024-09-29 04:48:46 UTC


README

Build Status PHPStan

此捆绑包为symfony项目提供基本内容管理工具。您可以将此捆绑包集成到现有系统中以添加CMS功能,或者用于简单的网站。

捆绑包实现了以下功能

  • 区块
  • 菜单
  • 页面
  • 博客/文章
  • 幻灯片(幻灯片放映)

捆绑包包含CRUD操作以及基本的行政模板,您可以覆盖它们(https://symfony.com.cn/doc/current/templating/overriding.html)。捆绑包还为您提供简单的“RouterController”用于页面。

安装

打开命令控制台,进入您的项目目录,并执行以下命令以下载此捆绑包的最新稳定版本

$ composer require mssimi/content-management-bundle

捆绑包使用其他几个捆绑包,您必须在AppKernel.php中启用它们

// app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new mssimi\ContentManagementBundle\ContentManagementBundle(),
            new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),
            new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
            new Ivory\CKEditorBundle\IvoryCKEditorBundle(),
            new Vich\UploaderBundle\VichUploaderBundle(),
            new Liip\ImagineBundle\LiipImagineBundle(),
        );
    }
}

路由 - 将以下行添加到您的app/config/routing.yml。警告!!! routing_page.yml必须放在最后!!!

content_management_admin:
    resource: "@ContentManagementBundle/Resources/config/routing_admin.yml"
    prefix:   /admin/
_liip_imagine:
    resource: "@LiipImagineBundle/Resources/config/routing.xml"
fos_js_routing:
    resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
content_management_page:
    resource: "@ContentManagementBundle/Resources/config/routing_page.yml"
    prefix:   /

配置

content_management:
    locales: ['en','de','fr']
    items_per_page: 10 # item per page for pagination in admin
    articles_per_page: 20 # articles per page in blog pagination
    page_template: 'cms/page.html.twig'
    blog_template: 'cms/blog.html.twig'
    article_template: 'cms/article.html.twig'
    
doctrine_phpcr:
    session:
        backend:
            type: doctrinedbal
            logging: true
            profiling: true
        workspace: default
    odm:
        auto_mapping: true
        auto_generate_proxy_classes: "%kernel.debug%"
        locales:
            en: []
            de: []
            fr: []
        locale_fallback: hardcoded
        default_locale: en

ivory_ck_editor:
    default_config: default
    configs:
        default:
            contentsCss: ['//maxcdn.bootstrap.ac.cn/bootstrap/3.3.7/css/bootstrap.min.css']
            allowedContent: true
            autoParagraph: false
            entities: false

vich_uploader:
    db_driver: orm
    mappings:
        content_management:
            uri_prefix:         /images/cms
            upload_destination: '%kernel.root_dir%/../web/images/cms'
            db_driver: phpcr

# filters used in admin, feel free to change config to fit your needs
liip_imagine:
    resolvers:
       default:
          web_path: ~
    filter_sets:
        cache: ~
        thumbnail: 
            quality: 75
            filters:
                strip: ~
                thumbnail: { size: [50, 50], mode: inset }
        slider:
            quality: 75
            filters:
                strip: ~
                thumbnail: { size: [1140, 560], mode: outbound }

有关更多信息,请查看以下链接

如果您想支持将图像上传到ckeditor,则强烈推荐此捆绑包。

启用缓存也强烈推荐

安装资源

$ php bin/console asset:install 

初始化数据库

$ php bin/console doctrine:phpcr:init:dbal 
$ php bin/console doctrine:phpcr:repository:init

如果以具有ROLE_CMS角色的用户登录,所有区块、菜单、滑块将显示快速编辑按钮。将此CSS文件添加到您的front base.html.twig,或提供您自己的编辑框CSS。

<link rel="stylesheet" href="{{ asset('bundles/contentmanagement/css/edit.css') }}">

示例在此 https://github.com/mssimi/ContentManagementDemo