Yii 1.1: cms

A modern and lightweight CMS module fit for any Yii project
96 followers

Current version 0.9.0

NordCms is a stand-alone module developed by Nord Software Ltd. This extension provides the core content management system functionality such as multilingual content and in place editing of content to any Yii project. NordCms is licensed under the New BSD License, please see the LICENSE file.

This extension was developed under a period of two weeks and there is definitely still room for improvement here and there. However, I wouldn't have released it to the public unless I was satisfied with it. I will continue working on improving this module in the future as well.

Links

What's included?

  • In place content editing using MarkItUp
  • Custom tags for dynamic content
  • Rendering of nodes as pages and/or widgets
  • Attachments such as images and other files
  • Multilingual content
  • Search engine optimization for pages
  • Support for both internal and external links
  • Email address obfuscation
  • Theme that uses my Bootstrap extension

For more detailed information please read the Usage section.

Setup

Unzip the extension under protected/modules/cms and add the following to your application configuration:

'imports'=>array(
    .....
    'application.modules.cms.CmsModule',
),
'modules'=>array(
    .....
    'cms',
),
'components'=>array(
    .....
    'urlManager'=>array(
        .....
        'rules'=>array(
            .....
            'page/<name>-<id:\d+>.html'=>'cms/node/page', // clean URLs for pages
        ),
    ),
    'cms'=>array(
        'class'=>'cms.components.Cms'
    ),
),

Next you need to create the necessary database tables by running the schema.sql in the data folder.

Configuration

The cms application component supports the following configuration parameters:

'cms'=>array(
    'class'=>'cms.components.Cms'
    // the names of the web users with access to the cms
    'users'=>array('admin'),
    // the langauges enabled for the cms
    'languages'=>array('en_us'=>'English'),
    // the default language
    'defaultLanguage'=>'en_us',
    // the types of files that can uploaded as attachments
    'allowedFileTypes'=>'jpg, gif, png',
    // the maximum allowed filesize for attachments
    'allowedFileSize'=>1024,
    // the path to save the attachments
    'attachmentPath'=>'/files/cms/attachments/',
    // the template to use for node headings
    'headingTemplate'=>'<h1 class="heading">{heading}</h1>',
    // the template to use for widget headings
    'widgetHeadingTemplate'=>'<h3 class="heading">{heading}</h3>',
    // the template to use for page titles
    'pageTitleTemplate'=>'{title} | {appName}',
    // the application layout to use with the cms
    'appLayout'=>'application.views.layouts.main',
    // the name of the error flash message categories
    'flashError'=>'error',
    'flashInfo'=>'info',
    'flashSuccess'=>'success',
    'flashWarning'=>'warning',
),

Please note that this is the component configuration, NOT the module.

Usage

Creating a page

Pages are created by linking to them. To create a page add the following to one of your views:

Yii::app()->cms->createUrl('foo');

What the above code does it creates a node with the name 'foo' (if it doesn't already exist) and returns the URL to that node.

You can also set the following page properties: URL, page title, meta title, meta description, meta keywords.

Creating a block

Blocks are used for displaying Cms content within views and they can be created using the CmsBlock widget. To add a block, add the following code to one of your views:

<?php $this->widget('cms.widgets.CmsBlock',array('name'=>'bar')) ?>

Adding content to a node

If you have permissions to update Cms content an 'Update' link will be displayed below the content. Nodes have a set of properties that can be specified per language:

  • Heading - the main heading
  • Body - the content
  • Stylesheet - stylesheet associated with the content
  • URL - the page URL (page/{url}-{id}.html)
  • Page Title - the page title
  • Breadcrumb - the breadcrumb text
  • Meta Title - the page meta title
  • Meta Description - the page meta description
  • Meta Keywords - the page meta keywords

Please note that the page properties are only used with pages.

It is possible to create relations between nodes by setting the parent. This will help you organize your content and it will also automatically set the correct breadcrumbs.

Editing content

You can use various tags within the body-field:

  • {{heading}} - the main heading
  • {{image:id}} - displays an attached image
  • {{node:name}} - _displays an inline node
  • {{file:id}} - creates a link to an attached file
  • {{email:address}} - creates a mailto link
  • {{name|text}} - creates an internal link
  • {{address|text}} - creates an external link

Please note that you cannot render inline nodes using the block widget.

Using NordCms with Bootstrap

NordCms comes with a theme that can be used with my Bootstrap extension.

To enable the bootstrap theme you first need to download and setup Bootstrap. When you have Bootstrap up and running you need to copy the files in themes/bootstrap/views to you themes/views folder. If you're not familiar with Yii's theming, read more about it here.

What's next?

  • Improving the interface for attachments
  • Further SEO optimization
  • Content revisions ?

Changes

May ?, 2012

  • Release 2.0.0
    • Polished UI using Twitter's Bootstrap
    • Functionality for creating menus
    • Page and blocks as separate models
    • Added page types to distinguish content
    • Database migrations
    • Requires Yii-Bootstrap
    • Changed to use Bootstrap as default
    • Removed themes

Stay tuned for the release!

Dec 15, 2011

  • Initial release

Total 20 comments

#15251 report it
trond at 2013/10/21 04:02am
Looks like this project has been abandoned

Maybe it could be used as a staring point for a new project. If the underlying data model is sound, the incompatibilities and hacks can always be fixed...

@Francois Gannaz: thanks for the warning. Saved me some time.

#15202 report it
François Gannaz at 2013/10/17 02:34pm
A complete mess of versions and dependencies

Be careful if you consider using this module. I spent hours on it, for a quite ugly result.

There are at least 4 "last" versions of this module:

  1. The online demo under the link "Try out version v2.0".
  2. The public repository of the demo at Bitbucket Crisu83/CmsDemo.
  3. The v2 of NordCms at Bitbucket (2012-05-28).
  4. The fork from the developper at Bitbucket, where the last commit is in 2012-11.

The code used by the online demo is NOT the v2. On the main CMS page, there are links for administering pages, blocks and menus, while NordCms v2 only has a "Create a new node" link. The demo is much more advanced than the v2.

So a logical decision is to use the updated fork. Unfortunately, it is unusable. As stated by an old issue that never got an answer, there is a hidden dependency on another module. That module seems to be yii-img by the same author, but there are many incompatibilities. And some really ugly code: the Cms module has SQL queries on tables created by the Img module, and, as expected, they break because the table has changed its structure. Because of this lack of encapsulation (ever heard of public API?), it would be hard to complete yii-img so that Crisu83/NordCms works.

Now option 1 isn't available, option 4 is broken, so there's just options 2 and 3. But it means using a very old version of the module, with dubious UI. I even saw bugs when installing (SQL error) and on the first form (CSS mis-alignment).

BTW, this module uses the extension yii-bootstrap at v0.9.X, now unmaintained, because of an API change on yii-bootstrap v1.0. It means Bootstrap 2.0 will be used, not 2.3.2 nor 3.0.

I thought I could contribute to this module. My first change to Crisu83/NordCms was to add foreign keys to the tables (and put NULL instead of 0!) and update accordingly the AR models, but why contribute to something I can't even install completely.

#14178 report it
ram87 at 2013/07/24 01:37pm
What a use this i don't know plz give me a after completed cms project

what is the use of this extension cms

finally how to display the content in yii framework...

#11813 report it
Alegbe Bamidele at 2013/02/05 11:02am
Please When us the version 2. 0 coming out?

i am working on a project, i am using yii bootstrap i think i would like to use nordCMS.. pls i am waitin for your reply...

#11667 report it
Tariq Aziz at 2013/01/25 11:20am
unable to access the module

I have configured and copy the module Now when I run the URL

localhost/webapp/index.php/cms

It says unable to solve the request "cms"

#11414 report it
rooney10 at 2013/01/12 09:13am
Version 2.0

Just wanted to know if the new announced version will come online, or has the work stopped? Thx :)

#10076 report it
WebDevPT at 2012/10/03 10:15am
Good job!

Keep up the good work.

Looks very cool and easy to change pages within the admin area.

#9830 report it
Hestimz at 2012/09/13 06:07pm
about V 2.0

hi, thank you for your great extensions, including rights ans Bootstrap. I'm currently about to start a new project, is it worth to wait for V 2.0 to release? is there going to be any release in near future at all? :)

#9326 report it
abajja at 2012/08/03 06:46am
Try out version 2.0

clicking on Try out version 2.0 and got:

Cms: Failed to create page. Name "вася" is invalid.
#8958 report it
Tomas L at 2012/07/09 06:40pm
Looking forward

Hey, really good job! Demo online is already V2.0 - correct? So you have it prepared? When could you put files on Bitbucket? Or maybe you could email ziped files?

#8897 report it
barcelona23 at 2012/07/06 07:47am
V2.0

Exc extension.

Where is V2.0??

#8814 report it
ibo_s at 2012/06/29 04:13pm
2.0

Hey,

where and when can we get V2.0 ? Is it not release ready yet ?

I would also like to contribute in any way.

Thx :)

#8585 report it
pckabeer at 2012/06/13 02:41am
Good Work

Great works guys.Keep the Spirit Going ......

#8475 report it
andyofb at 2012/06/06 08:20am
When is Release 2.0.0 set for?

Any ideas when the release will be?

#8159 report it
peili at 2012/05/13 05:54pm
Please Fix the Demo

Please Fix the Demo -- Thank you!

#8045 report it
Lastik at 2012/05/05 07:58am
Demo not working

Demo not working :-(

#7043 report it
Tibor Katelbach at 2012/02/21 02:13am
use view files as cmsWidgets

I want to add this into a node {{nodeFile:pathtoview}} which would simply render a view file as part of the nodes render I'm wondering if maybe someone had this running ?

#7017 report it
Tibor Katelbach at 2012/02/19 11:10am
multi lingual

Hi Guys Thanks for the great module , it's promissing I was trying to play with internationalisation but as I change locale, the content disapears? it only works when local is empty I set up my 2 languages in the components configs is there something else to set up ? The Admin tool give the Languages to ttranslate which is fine but the front end reacts strangely I noticed the module stops working if sourcemessage and language parameters are used in the config file

could you show us how to use localisation for Node or widget Rendering ? in your demo I see http://www.cniska.net/cmsdemo/index.php/languages/default/changeLanguage/language/sw is this a language module ? self Answer : The module uses Yii::app()->language set up programaticaly or from the main config 'language' => 'en_us' The Module will then render the content localised to the active language

#6767 report it
Chris83 at 2012/02/03 10:48am
@qstyler

Yes it definitely would but it's not that simple. Do you have any suggestion on how to achieve this?

#6766 report it
Chris83 at 2012/02/03 10:47am
@morten

The Controller class is not a part of Yii, it's just a class generated by the webapp command. Not everyone uses that command so you cannot rely on that the class actually exists in every application.

Leave a comment

Please to leave your comment.

Create extension
Downloads