schallschlucker/yii2-simple-cms 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

schallschlucker/yii2-simple-cms

Composer 安装命令:

composer require schallschlucker/yii2-simple-cms

包简介

a basic yii2 content management extension for easily creating and maintaining a page structure for frontend use

README 文档

README

A basic yii2 content management module for easily creating and maintaining a page structure, including navigation widget, full text search, image and document management and a wysiwyg html editor for the content pages. Does not include an fine granulated access rights management, only differentiates between: anonymous/guest and logged in users. The extensions supports site structures in multiple languages for international sites.

NOTE: Module is in initial development. Anything may change at any time.

Documentation

Yii2-simple-cms documentation is available online:

See Project page for source code and Project wiki for more details, screenshots etc.

Installation instructions are located in the installation guide

Prefered way is using composer by adding the reuquirement to your composer.json and running composer update afterwards:

"require": {
    "schallschlucker/yii2-simple-cms": ">=0.2.4",
}

After installation run migration for database table creation (it is assumed at this point, that the yii2 db module is configured properly in your configuration). Currently the scripts support only mysql databases, other databases might work as well but haven't been tested yet and thus are disabled in the migration script):

yii migrate --migrationPath=@schallschlucker/simplecms/migrations

Finally create a folder where to store the uploaded images from the WYSIWYG editor. To do so, create a subfolder named "mediarepository" in the web folder of you application. If you use separated applications for backend and frontend, simply create a simlink to the sceond web folder to use the mediarepository there as well. Then set the access rights to this folder accordingly so that php is allowed to write to this folder.

It is also possible to place the mediarepository outside of the web folder to limit access to uploaded files, but then each file needs to be read by php and delivered to the client which certainly has an impact on the performance, so this should only be used if the media data is somewhat sensitive and should only be availbale to logged in users. when the folder is not placed in the web folder, the module configuration needs to be changed (at the moment you need to edit the backend.php and frontend.php file in the vendor folder of simple-cms, in future versions we will document how to overwrite the path in the module configuration)

#Usage

the extension is split into two modules: the frontend and the backend module.

Frontend provides the needed controllers to: - display page content - display documents - display a search form and a search result page Widgets to: - render a navigation menu (extending yii\bootstrap\Nav widget) - render the navigation structure in different formats like a html list (ol or ul and li nodes), xml, json - render the search bar - render extended search form - render the search results list

The backend provides administrative functions for maintaining the page tree structure (including drag and drop functionality, keyboard shortcuts and context menus for easy creation of new pages).

Both modules can be deployed in the same application, but it is recommended to follow the frontend/backend approach to clearly separate the frontend (user view) from the administrative backend interface.

Content pages in simple cms can be created in multiple language, since simple cms uses internal language id's which might differ from your applications language codes (i.e. ISO 2 letter code or 5 letter code) you need ti initalize the LanguageManager in the components section with a valid mapping to map you applications language codes to the simple cms language codes. Here is an example (which also uses aliases to e.g. map the application language code "de-DE" to the simple cms language code "1" etc.). You can add support for additional languages in simple cms just by adding new mappings.:

'components' => [
	'simplecmsLanguageManager' => [
    	'class' => 'schallschlucker\simplecms\LanguageManager',
    	'languageIdMappings' => [
            '1' => [
			    'id' => 1,
                	'code' => 'de_DE', 
	                'displaytext' => [
    	                'de_DE' => 'deutsch', 
        	            'en_US' => 'german',
            	        'pl_PL' => 'niemiecki',
                	    'tr_TR' => 'alman',
	                ],
    	        ],
                'de_DE' => [
                    'alias' => '1'
                ],
                'de-DE' => [
                	'alias' => '1'
	            ],
    	        '2' => [
        	        'id' => 2,
			        'code' => 'en_US', 
            	    'displaytext' => [
                	   	'de_DE' => 'englisch', 
                    	'en_US' => 'english',
	                    'pl_PL' => 'angielski',
    	                'tr_TR' => 'ingilizce',
        	        ],
            	],
                'en_US' => [
                    'alias' => '2',
                ],
                'en-US' => [
    	            'alias' => '2',
        	    ],
            	'3' => [
					'id' => 3,
                	'code' => 'pl_PL', 
	                'displaytext' => [
    	                'de_DE' => 'polnisch', 
        	            'en_US' => 'polish',
            	        'pl_PL' => 'polski',
                	    'tr_TR' => 'lehçe',
	                ],
    	        ],
        	    '4' => [
            	    'id' => 4,
					'code' => 'tr_TR', 
                	'displaytext' => [
                    	'de_DE' => 'türkisch', 
	                    'en_US' => 'turkish',
    	                'pl_PL' => 'turecki',
        	            'tr_TR' => 'türk',
            	    ],
            	],
    	],
],
'modules' => [
	'simplecms_backend' => [
        'class' => 'schallschlucker\simplecms\Backend',
		'languageManager' => 'simplecmsLanguageManager',
		'cache' => 'cache',
        ],
	'simplecms_frontend' => [
		'urlPrefix' => 'cms', //the context alias for the module if you do not want to use simplecms_frotend in your URLs to call the pretty URL aliases
        'class' => 'schallschlucker\simplecms\Frontend',
		'languageManager' => simplecmsLanguageManager,
		'renderTopMenuNavbar' => true, //boolean to indicate if a bootstrap navbar dropdown navigation (using CmsBootstrapNavbarWidget) should be rendered by the view. Set to false of you build your own navigation using one of the widgets provided by simplecms (e.g. CmsBootstrapNavbarWidget or CmsSitemapWidget)  (optional, default is true)
		'htmlTitlePrefix' => '', //string to prepend to html title tag (optional, default is empty)
		'htmlTitleSuffix' => '', //string to append to generated html title tag (optional, default is empt)
		'cache' => 'cache' //NOTE: remove this line if you do not have a cache component configured. Caching will reduce the load on the server a lot when building page trees, so it is highly recommended to user a proper cache implementation like memcached etc.
    ],
    'media_manager' => [
        'class' => 'schallschlucker\simplecms\MediaManager',
        'mediarepositoryPath' => '/var/www/virtualhosts/www.einzelpflegefachkraft.de/curassist-app/mediarepository/',
    ],
],

After the modules are registered, you should be able to open the administration backend by calling the "simplecms_backend" route e.g. by calling:

http://yourserver/index.php?r=simplecms_backend

or if pretty URLs are activated:

http://yourserver/simplecms_backend

Then you should see the Simple CMS Administration Backend with a root node in the page-tree. By right-clicking on the root node you can add new pages to the page tree. Each page has multiple language versions, so you can create common page tree structure for all different language versions. Via drag and drop you can rearange the positions of the pages within the page tree. Each page (except for the root node) can be set to one of three states:

  • visible: it will show up in the rendered navigation by the navigation widget
  • hidden: the page won't be shown in the navigation, yet it can be linked of found in the search
  • unpublished: the page will neither be shown in the navigation nor in the search results and cannot be linked

Each page can have three different behavious/types:

  • content page: the page is a normal content whose content can be edited via the embeded WYSIWYG editor
  • linked document: the page is basically a link to a uploaded document (e.g. PDF) that will be rendered as a link in the navigation
  • URL: the page will directly link to any given URL. This can be used to create an alias of a page in the navigation or to link to an external URL and embedding this link in the normal navigation

You can select one of these page types when creating a new page language version.

Please note:

In order for the page administration to work you need to be logged in, otherwise an error will occur since the user id will be stored for auditing purposes upon page creation or modification.

License

yii2-simple-cms is released under the Apache License 2.0. See the bundled LICENSE.md for details.

schallschlucker/yii2-simple-cms 适用场景与选型建议

schallschlucker/yii2-simple-cms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.45k 次下载、GitHub Stars 达 44, 最近一次更新时间为 2014 年 12 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「wysiwyg」 「content management」 「yii2」 「pagetree」 「yii2-cms」 「schallschlucker」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 schallschlucker/yii2-simple-cms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 schallschlucker/yii2-simple-cms 我们能提供哪些服务?
定制开发 / 二次开发

基于 schallschlucker/yii2-simple-cms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.45k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 45
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 44
  • Watchers: 10
  • Forks: 25
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2014-12-17