installing the Symfony plugin sfSimpleCMS
Posted in Development on August 2, 2007
I was recently asked if I'd sucessfully got the Symfony plugin sfSimpleCMS working and I'm afraid my answer was no. I had tried briefly when preparing for my talk, but something didn't work and I carried on with other things.
Being reminded of it and having an hour to kill before I head off to the pub I thought I'd give it a stab, here we go...
My environment is PHP 5.2.3 on Debian Woody.
Upgrade to latest stable version (as root):
pear upgrade symfony/symfony
Stop being root and create test sandbox:
cd ~/www/TEST/ mkdir sfSimpleCMS && cd sfSimpleCMS
...obviously your paths can be different.
Create project and app
symfony init-project cms symfony init-app frontend
Set-up the Apache Virtual Host:
ServerName sfSimpleCMS.bealers DocumentRoot "/home/bealers/www/TEST/sfSimpleCMS/web" DirectoryIndex index.php php_flag magic_quotes_gpc off php_flag register_globals off Alias /sf /usr/share/php/data/symfony/web/sf AllowOverride All Allow from All
LogFormat "%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i""
TransferLog /var/log/apache/sfSimpleCMS.log
ErrorLog /var/log/apache/sfSimpleCMS.log
...your paths should match the location of your sandbox
Restart apache (as root, or use sudo)
apachectl reload
Make sure that your hostname resolves to the IP of the server and then try it in your browser in my case http://sfSimpleCMS.bealers
Do some simple config
mysql> create database cms; mysql> grant all on cms.* to cms@localhost identified by 'cms';
Edit config/propel.ini so that:
propel.database.createUrl = mysql://cms:cms@localhost/ propel.database.url = mysql://cms:cms@localhost/cms
Edit config/databases.yml so that:
all: propel: class: sfPropelDatabase param: dsn: mysql://cms:cms@localhost/cms
Install the re-prequisites
symfony plugin-install http://plugins.symfony-project.com/sfGuardPlugin symfony cc
symfony plugin-install http://plugins.symfony-project.com/sfPropelActAsNestedSetBehaviorPlugin
Edit config/propel.ini so that:
propel.builder.addBehaviors = true
Install tiny MCE
cd /tmp wget http://prdownloads.sourceforge.net/tinymce/tinymce_2_1_1_1.tgz?download tar -zxvf tinymce_2_1_1_1.tgz
Move the actual useful bit to our Symfony project (obviously change this to contain the right path for you)
mv tinymce/jscripts/tiny_mce/ ~/www/TEST/sfSimpleCMS/web/js
Tidy up
rm -Rf tinymce*
Get back to our project
cd ~/www/TEST/sfSimpleCMS
Install sfSimpleCMS
symfony plugin-install http://plugins.symfony-project.com/sfSimpleCMSPlugin
Build everything
symfony propel-build-all
Our database now looks like this:
Edit apps/frontend/config/settings.yml so that:
all: .settings: enabled_modules: [default, sfSimpleCMS, sfSimpleCMSAdmin] sfSimpleCMS: default_text: '[add text here]' # Default text for page editable parts routes_register: on # Use the plugin's routes rich_editing: on # Use TinyMCE for rich text editing default_page: home # Slug (=path) of the default root page home_link: My swell site # what is displayed on the top right corner of the pages (can be HTML code) use_l10n: false # Enable multiple versions for a single page localizations: [en, fr, es] # 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: Simple Page # 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 Image: Image Modular: List of components
Import some data. I was unable to get the fixtures to load by running:
symfony propel-load-data frontend pluginssfSimpleCMSPlugindatafixtures (actually I've never had much luck with loading data from fixtures, but that's another story) so with a bit of trial and error I came up with this simple query which'll give us our first page (if we don't do this things go a bit weird and the top element has no template assigned so the view barfs).
mysql> insert into sf_simple_cms_page set id=1, slug="home", template="home", tree_left=1, tree_right=2, is_published=1, created_at=NOW();
Visiting http://sfsimplecms.bealers/frontend_dev.php/sfSimpleCMSAdmin/ should give you the site!
Double clicking on the content areas opens an editing window. I've been unable to get rich text editing working with tinyMCE but I guess it's in the wrong place in the directory tree. I notice that theres a sfSimpleCMSPlugin folder under web that has its own js folder. Maybe it needs to go in there but I'll leave that as an excersise for the reader whilst I head off to the pub.
Here's the official plugin page for further reference.
Note: It see that Wordpress has munged the tabs which are important for the yml files. I suggest you look at the official plugin page above should you be unsure of the tab order. I'll attempt to tidy it up some time soon.