sfSimpleCMSPlugin - 0.6.0

Simple Content Management System (CMS) for symfony

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source | Show as Markdown



This plugin allows you to add a simple Content Management System (CMS) to your symfony application with the following features:

  • Uses Javascript and Ajax to provide a neat user experience

  • Edit zones in pages

  • Edit page URL (you can use / in page path)

  • Edit content in the real context ('edit in place')

  • Preview result

  • Create and manage a tree structure for pages

  • i18n ready (the interface is translated)

  • l10n ready (a page can have different versions)

  • support multiple templates

  • Basic publication workflow

  • Breadcrumb navigation

  • User management is controlled through sfGuardPlugin

It is not aimed at replacing full-featured CMS packages, but offers a lightweight alternative for when you build a website that has to contain pages often updated by special users. It is voluntarily simple, and very easy to configure; so it should fulfill most basic CMS requirements.

Please note that this plugin is in active development. If you want to help and improve it, please contact François Zaninotto.




The prerequisites for using the sfSimpleCMS plugin are:

  • As the plugin doesn't contain a user management module, the project where you install it must have a table managing authors, or users (whatever the name), and the related Propel class must have a __toString() method. Both these conditions are satisfied by the sfGuardPlugin, so installing this plugin is a good choice.

  • The page tree strucure uses the sfPropelActAsNestedSetBehaviorPlugin. The plugin must be installed and behaviors enabled in your propel.ini.

  • Rich text editing uses tinyMCE. You must install tinyMCE if you want a wysiwyg interface for text editing.

To install the plugin for a symfony project, the usual process is to use the symfony command line:

$ php symfony plugin-install http://plugins.symfony-project.com/sfSimpleCMSPlugin

Alternatively, if you don't have PEAR installed, you can download the latest package attached to this plugin's wiki page and extract it under your project's plugins/ directory. You will also have to copy the contents of the myproject/plugins/sfSimpleCMSPlugin/web/ directory into a myproject/web/sfSimpleCMSPlugin/ directory.

Rebuild the model, generate the SQL code for the new tables and insert it into your database:

$ php symfony propel-build-all

Clear the cache to enable the autoloading to find the new classes:

$ php symfony cc

You can load the included fixtures to start using the forum with test data.

$ php symfony propel-load-data frontend plugins\sfSimpleCMSPlugin\data\fixtures

Enable the new sfSimpleCMS and sfSimpleCMSAdmin modules in your application, via the settings.yml file.

// in myproject/apps/frontend/config/settings.yml
    enabled_modules:        [sfSimpleCMS, sfSimpleCMSAdmin](default,)

Start using the plugin by browsing to the admin module's default page:


There, you will be able to create the root page (if you didn't insert the fixtures) and add new pages. You will also be able to access the new pages in edit mode from the admin section.

Basic usage

Pages created by the sfSimpleCMSPlugin all have a path property. Using this path, you will be able to see the page in the frontend. For instance, if a page is created with the path foo/bar, you will be able to see it by browsing to:


Only published pages are accessible that way.

To edit it, just add a ?edit=true query string to this URL. If the current user has the proper credentials, he will then get access to the edit features:


In this mode, all the editable zones of a page can be modified by double-clicking in the zone and changing the content in the form control that appears. Even unpublished pages can be edited that way.

Once the page is edited, you can preview the result by adding preview=true to the query string:


The editor toolbox will automate all that and, in practice, you will never need to edit the URL.



Some of the features of the plugin can be altered by configuration. To do so, add some of the following lines to your application's app.yml:

    default_text:         '[text here](add)'   # Default text for page editable parts
    routes_register:      on                  # Use the plugin's routes 
    rich_editing:         off                 # Use TinyMCE for rich text editing
    default_page:         home                # Slug (=path) of the default root page
    use_l10n:             false               # Enable multiple versions for a single page
    localizations:        [fr, es](en,)        # If l10n is enabled, list of cultures in which pages are available
    default_culture:      en                  # If l10n is not enabled, default culture for pages
    editor_credential:                        # Name of the credential required for page editing (leave blank for free editing)
    publisher_credential:                     # Name of the credential required for page publishing (leave blank for free publishing)
    templates:                                # Available templates 
      simplePage:         SimplePage          #   the key is the name of a template which must be present in modules/sfSimpleCMS/templates/
      home:               Home                #   the value is the name under which the template is presented in lists
    slot_types:                               # Available slot types
      Text:           Simple text
      RichText:       Rich text
      Php:            PHP code

Routing rules

The plugin comes with a few routing rules.

# main route to browsing the pages
  url: /cms/:slug
  param: { module: sfSimpleCMS, action: show }
  requirements: { slug: '.*'}

  url: /cms_delete/:slug
  param: { module: sfSimpleCMS, action: delete }
  requirements: { slug: '.*'}

  url: /cms_publish/:slug
  param: { module: sfSimpleCMS, action: togglePublish }
  requirements: { slug: '.*'}

If you want to use your own routes instead, turn the routes_register parameter to off in the app.yml.


The plugin is bundled with a few basic templates, but you will definitely need to add your own templates.

CMS templates are files located under the sfSimpleCMS module's templates/ directory, with a name ending with Template.php. A template must include the sfSimpleCMS helper group and call the include_editor_tools() helper at the bottom.

As for page zones, you will need two more helpers to manipulate them:

  • sf_simple_cms_has_slot($slot_name): returns true if a page slot is set, false otherwise
  • sf_simple_cms_slot($slot_name, $default text): includes the slot if in view mode, or the editable version of the slot if in edit mode.

The possible values for the slot name are currently limited to: Title, Slot1, Slot2, Slot3, Slot4.

Look and Feel

The sfSimpleForum module comes with a default stylesheet. You can choose to use your own stylesheet instead of the default one. To do so, you must create an empty sfSimpleCMS module inside your application with just one config/view.yml file in it, with the followin content:

  stylesheets: [myCustomStylesheet](-/sfSimpleCMSPlugin/css/CMSTemplates.css,)


  • Enhance documentation
  • Better toolbox CSS for IE
  • Better templates CSS by default
  • Add more templates
  • Add more components and partials to be used in templates
  • Refactor the sfSimpleCMS action code to make it DRYier (use mixins?)
  • Add a validator for the slug
  • Ability to use a list of components as the value of a slot
  • Better integration with sfGuard
  • Search engine
  • Package with other plugins into an application


2007-07-16 | 0.6.0 Beta

  • francois: initial release