This is not a real cms, it cannot create new pages and so on.
It is useful in an application that is 90% dynamical, with content that cannot be managed with any cms, and a 10% of text.
This extension supply a simple div with text. The text can be managed in-place with a dialog box with a text area (you can easily enhance using any of the WYSIWYG in extension)
Requirements ¶
Yii 1.5 or higher.
Usage ¶
Add this table to the database:
[sql]
CREATE TABLE IF NOT EXISTS `content` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`label` varchar(50) CHARACTER SET utf8 NOT NULL,
`text` longtext CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `label` (`label`)
) ;
Extract the zip file in extension, then configure the main config as follows:
<?php
return array(
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
'application.extensions.simpleCMS.*',
),
// application components
'components'=>array(
'user'=>array(
'class'=>'ZWebUser',
),
);
Add the directoty to the paths and we chagne the user class. We need a user class with a method that says wether a user is admin (not all application uses RBAC).
Now add this line in SiteController:
<?php
class SiteController extends Controller
{
public function actions()
{
return array(
'updateCms'=>'ActionUpdateCms',
);
}
}
This line add an action to the SiteController for answer to the widget.
The trick is done! You can create your box in this way:
<?php $this->widget('simpleCMS', array('label'=>'textId'))?>
name?
As you wrote on the first line, this is not a CMS... so why call it simpleCMS?
re: name
This widget is meant to be used in context in wich a cms is too much or is not appliable.
Atually it gives the possibility of manage content, so it is by definition a content managment system, but is much simplier than any cms, as it is not providing create page features.
That's the reason of the name: too simple for cms, but anyway cms
Paths
Hi,
in your paths you use extension instead of the autogenerated extensions _ "s" is different, so I had to fix it manually. Hopes this saves time for others to implement...
And I changed the user role check to Yii:app()->user->checkAccess('admin'); What worked fine for me;)
cheers Phil
@philippfrenzel
HI!
Thank you for kind signalation, I updated the article accordigly.
About the user role check, I agree with you that this is the standard way, I implemented differenty in order to give an example of custom implementation, to use in scenario in wich there is no rbac but just a boolean fields in table user
(wich are the majority of my application, btw)
Errors
I'm trying to implement this extension and there's been a few things I've needed to change, but now I'm stuck with an error on line 44 on the file "div.php", which is:
<?php echo FHtml::CLTextArea($model,'text'); ?>
Changing this to CHtml didn't work and I couldn't find a CLTextArea method from YII class references either.
Any suggestions?
Working now
Works with the following:
<?php echo CHtml::activeTextArea($model,'text'); ?>
ops
By bad, I forgot the wysiwyg textarea.
I will update this wiki in the next days using this approach, wich is compatible with opera.
update
Hi!
I have update the cms class for implement following this guide.
If anyone notice some more error, please ask here!
problem on linux
on linux (case sensitive file system) I've replaced all simpleCMS and SimpleCms to SimpleCMS, because yii not find it.
PS: I've integrated CKeditor with simplecms and it's not easy (problem with jquery ui modal and with id Content_text not unique).
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.