Home > cakephp-cms-plugin

cakephp-cms-plugin

Cakephp-cms-plugin is a project mainly written in PHP, it's free.

A CMS plugin for CakePHP

Steps for setting this up:

1) Add the contents table:

-- Table structure for table contents

CREATE TABLE IF NOT EXISTS contents ( id int(10) unsigned NOT NULL auto_increment, parent_id int(11) NOT NULL, lft int(11) NOT NULL, rght int(11) NOT NULL, permalink varchar(255) NOT NULL, sort_order varchar(50) NOT NULL, controller varchar(64) NOT NULL default '', action varchar(64) NOT NULL default '', title varchar(255) NOT NULL default '', leadin text NOT NULL, content text NOT NULL, hidden tinyint(1) NOT NULL default '0', nl2br tinyint(1) NOT NULL default '1', created datetime default NULL, modified datetime default NULL, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

2) Set up routes Router::connect('/contents/*', array('plugin' => 'cms', 'controller' => 'contents', 'action' => 'display'));

3) Move tiny_mce to app/webroot/js

4) set up app/webroot/uploads and make it server-writable

You can also define MAX_DEPTH somewhere [like define('MAX_DEPTH', 4);] and that will control how many layers of subpages can be created. MAX_DEPTH of 1 will mean no subpages. Currently, this is in cms_app_controller.php but it could be just about anywhere, like core.php, for example, if you want to consolidate your configuration a little.

Protip: You can use $this->requestAction() within a view or element to grab content from the plugin without too much hassle. For example:

$content_obj = $this->requestAction(array('plugin' => 'cms', 'controller' => 'contents', 'action' => 'getContentByPermalink'), array('pass' => array('arbitrary-permalink'))); echo $content_obj['Content']['content'];

Previous:1