Features:
- Create Page/PageSet/Link
- Sort items
- Set page templates, subtemplates, layouts
- Set title, metatags, description
- Public\Authorised access to pages.
Main feature: Absolute URLS from the root of project without creating controllers.
Requirements ¶
Yii 1.4 or above.
SETTING UP. ¶
- copy files of module to modules/cms.
- activate module in config:
'modules'=>array(
...,
'cms'=>array(
// this layout will be set by default if no layout set for page
//'defaultLayout'=>'cms',
),
...
),
- Module uses nested set extension and translitUrl extension. Extensions are not in archive, you can download extensions in archive extensions.zip and unpack them to application.extensions path.
Set
'import'=>array(
'application.models.*',
'application.components.*',
'application.extensions.nestedset.*', // import nested set extension
)
- set components config
'components'=>array(
...,
'errorHandler'=>array(
'class'=>'application.modules.cms.components.CmsHandler',
),
'db'=>array(
...,
'tablePrefix'=>'', // even empty table prefix required!!!
...
),
...,
'urlManager'=>array(
'urlFormat'=>'path',
....
'showScriptName'=>false,
),
),
Copy .htaccess from archive to root directory of project
Installation database(mysql): go to cms module via route PROJECT_ROOT/cms/install Press "install database" link.
After database installed, log in, go to http://PROJECT_URL/cms/and manage your pages!!!
Resources ¶
HOW TO MAKE HOME PAGE OF PROJECT EDITABLE VIA CMS MODULE: ¶
put this code to your default conntroller:
public function actionIndex()
{
Yii::import('application.modules.cms.components.CmsHandler');
CmsHandler::renderHomePage();
}
Looks not bad
Looks not bad, I thisnk it will partially used in my project.
Но все равно, сыровато немного выглядит. На CMS немного не тянет. Способность к расширяемости практически нулевая.
Re: Looks not bad
This is module for managing pages - not CMS.
Post comments in English
@GOsha: Please post your comments in English, so also non-Russian-speaking users can understand, what you mean! Thank you!
typo
Requirements ¶
Yii 1.4 or above. --- tis actually Yii 1.1.4
it is a good idea the project
Problem with errorhandler
I have tested your cms and it seems to be very usefull for me, thanks :-)
But I have a problem with your way to activate your CmsHandler by installing your errorhandler. I have changed your code to a more "serios" way, so you don't need the errorhandler.
... 'controllerMap' => array( 'content'=>'application.modules.cms.components.CmsHandler', ), ...
Changes in your CmsHandler.php
public $pageRoute = 'content';
public function run($actionID) { Yii::import('application.modules.cms.models.*'); $page = Cms::model()->find('url=:url', array(':url'=>$this- >pageRoute.'/'.$actionID)); if ($page) $this->processCms($page); else parent::run($actionID); }
That's all.
You don't need the functions "handle()" and "initCms()" in your controller and registering your errorhandler any more.
Sideeffect/Todo:
When creating or calling pages you always have to use the prefix "content/..." in the url.
Maybe this "pageRoute" can be set automatically when saving the url of the page or generating menus ...
Update: Problem with errorhandler
Sorry, had a mistake ...
The function run can look like this:
public function run($actionID) { Yii::import('application.modules.cms.models.*'); $page = Cms::model()->find('url=:url',array(':url'=>$actionID)); if ($page) $this->processCms($page); else parent::run($actionID); }
You don't need to always add the "pageRoute" in the url field when creating pages.
getTreeViewData function
Hi,great extension.I would be grateful if you could explain what is happening inside getTreeViewData function in TreeMenu class,it is used to convert a flat array of nodes into nested one.For example I have yet to grasp what the position array does or the lastitem variable.It would be very helpful to me if you could very briefely outline the logic you use to build the nested array of nodes.Thanks in advance.
Unable to install
I am new to php and yii.
I have followed all the step given above but on running it i am getting the error below, kindly let me know how to resolve this?
( ! ) Notice: Undefined variable: id in E:\wamp\www\realestate\protected\modules\cms\components\CmsHandler.php on line 11
Call Stack
Time Memory Function Location
1 0.0005 371088 {main}( ) ..\index.php:0
2 0.0210 1893056 CApplication->run( ) ..\index.php:13
3 0.0210 1893056 CWebApplication->processRequest( ) ..\CApplication.php:155
4 0.0238 2090928 CWebApplication->runController( ) ..\CWebApplication.php:121
5 0.0312 2624680 CController->run( ) ..\CWebApplication.php:328
6 0.0323 2659928 CController->runActionWithFilters( ) ..\CController.php:257
7 0.0340 2738128 CFilterChain->run( ) ..\CController.php:283
8 0.0342 2739024 CInlineFilter->filter( ) ..\CFilterChain.php:130
9 0.0342 2739088 CController->filterAccessControl( ) ..\CInlineFilter.php:59
10 0.0353 2823688 CFilter->filter( ) ..\CController.php:1088
11 0.0394 3108752 CFilterChain->run( ) ..\CFilter.php:41
12 0.0394 3108752 CController->runAction( ) ..\CFilterChain.php:133
13 0.0394 3108752 CInlineAction->run( ) ..\CController.php:300
14 0.0394 3110088 ReflectionMethod->invokeArgs( ) ..\CInlineAction.php:54
15 0.0394 3110104 CmsController->actionAdmin( ) ..\CmsController.php:0
16 0.0984 5689112 CController->render( ) ..\CmsController.php:172
17 0.0984 5689176 CController->renderPartial( ) ..\CController.php:746
18 0.0986 5689528 CBaseController->renderFile( ) ..\CController.php:833
19 0.0986 5689592 CBaseController->renderInternal( ) ..\CBaseController.php:88
20 0.0993 5746728 require( 'E:\wamp\www\realestate\protected\modules\cms\views\cms\admin.php' ) ..\CBaseController.php:119
21 0.1017 5764904 CApplication->handleError( ) ..\CApplication.php:0
22 0.1029 5798328 CApplication->getErrorHandler( ) ..\CApplication.php:714
23 0.1029 5798384 CModule->getComponent( ) ..\CApplication.php:435
24 0.1031 5799496 YiiBase::createComponent( ) ..\CModule.php:371
25 0.1042 5873160 CmsHandler->__construct( ) ..\YiiBase.php:211
Also unable to install
Getting same error as utkarshpanwar
Error
Any idea about that error?
PDOException There is already an active transaction (/Users/linux-user/mydata/webproject/yii/framework/db/CDbConnection.php:460) #0 /Users/linux-user/mydata/webproject/yii/framework/db/CDbConnection.php(460): PDO->beginTransaction() #1 /Users/linux-user/mydata/webproject/yii/protected/extensions/nestedset/TreeBehavior.php(840): CDbConnection->beginTransaction() #2 /Users/linux-user/mydata/webproject/yii/protected/extensions/nestedset/TreeBehavior.php(674): TreeBehavior->moveNode(Object(TreeBehavior), true, true) #3 [internal function]: TreeBehavior->moveBelow(Object(TreeBehavior)) #4 /Users/linux-user/mydata/webproject/yii/framework/base/CComponent.php(261): call_user_func_array(Array, Array) #5 /Users/linux-user/mydata/webproject/yii/framework/db/ar/CActiveRecord.php(213): CComponent->__call('moveBelow', Array) #6 [internal function]: CActiveRecord->__call('moveBelow', Array) #7 /Users/linux-user/mydata/webproject/yii/protected/extensions/nestedset/TreeBehavior.php(375): Cms->moveBelow(Object(TreeBehavior)) #8 [internal function]: TreeBehavior->appendChild(Object(Cms)) #9 /Users/linux-user/mydata/webproject/yii/framework/base/CComponent.php(261): call_user_func_array(Array, Array) #10 /Users/linux-user/mydata/webproject/yii/framework/db/ar/CActiveRecord.php(213): CComponent->__call('appendChild', Array) #11 [internal function]: CActiveRecord->__call('appendChild', Array) #12 /Users/linux-user/mydata/webproject/yii/protected/modules/cms/controllers/CmsController.php(144): Cms->appendChild(Object(Cms)) #13 [internal function]: CmsController->actionUpdate('12') #14 /Users/linux-user/mydata/webproject/yii/framework/web/actions/CAction.php(104): ReflectionMethod->invokeArgs(Object(CmsController), Array) #15 /Users/linux-user/mydata/webproject/yii/framework/web/actions/CInlineAction.php(48): CAction->runWithParamsInternal(Object(CmsController), Object(ReflectionMethod), Array) #16 /Users/linux-user/mydata/webproject/yii/framework/web/CController.php(300): CInlineAction->runWithParams(Array) #17 /Users/linux-user/mydata/webproject/yii/framework/web/filters/CFilterChain.php(133): CController->runAction(Object(CInlineAction)) #18 /Users/linux-user/mydata/webproject/yii/framework/web/filters/CFilter.php(41): CFilterChain->run() #19 /Users/linux-user/mydata/webproject/yii/framework/web/CController.php(1122): CFilter->filter(Object(CFilterChain)) #20 /Users/linux-user/mydata/webproject/yii/framework/web/filters/CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain)) #21 /Users/linux-user/mydata/webproject/yii/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter(Object(CFilterChain)) #22 /Users/linux-user/mydata/webproject/yii/framework/web/CController.php(283): CFilterChain->run() #23 /Users/linux-user/mydata/webproject/yii/framework/web/CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array) #24 /Users/linux-user/mydata/webproject/yii/framework/web/CWebApplication.php(328): CController->run('update') #25 /Users/linux-user/mydata/webproject/yii/framework/web/CWebApplication.php(121): CWebApplication->runController('cms/cms/update/...') #26 /Users/linux-user/mydata/webproject/yii/framework/base/CApplication.php(155): CWebApplication->processRequest() #27 /Users/linux-user/mydata/webproject/yii/htdocs/index.php(23): CApplication->run() #28 {main}
More info required
which version of Yii are you using?
Which database throws this error?
I've setted my module on clean Yii 1.1.7 and everything works well...
Please describe situation.
Not working on Linux
I tried this module and it works like a charm on Windows server.
But when I moved my test site to Linux server it does not work.
I managed to get the cms pages to display properly but I am not able to get the admin side from where we manage pages to work properly.
What to do?
Regards,
Yogi Yang
no demo
Demo URL seams to be no longer working, where can I check it out?
CmsHandler not found
Hi there,
When I try to visit cms/ I get the following error:
> You are not authorized to perform this action. (C:\wamp\yii\framework\web\auth\CAccessControlFilter.php:182)
Any ideas?
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.