Comparing CMS/blog systems, part 3.2: CMS Made Simple day to day

Having gone through the setup of my new site for PL PHP in Comparing CMS/blog systems, part 3.1: Typo3 day to day I next wanted to try going through the same with CMS Made Simple. As noted in Comparing CMS/blog systems, part 2 I didn't get CMS Made Simple installed the first time round, but as I lowered my expectations PHP version I got it working without problems. So after a few minutes, it was time for my second try at creating PL PHP

Hands dirty

Part of installing CMS Made Simple is typically installing default templates and content. So, unlike Typo3 where the first thing you see of your site is an error, with CMSMS you see a working site with content. This is good and bad: it gives you a good idea of what CMSMS can do, but it also means you have to figure out how to change what's already there - sometimes a clean slate is easier to work with.

It's not a big problem in any way, though. Diving into the work without checking any docs quickly led me to the templates point under the layout menu. From here, you can easily create a new template as well as have a look at existing ones to learn from. However, when you create a new template, CMSMS prefills it with various goodies that you'll typically need - so, I didn't have any need for looking at other templates to get me going. Looking at the syntax of the prefilled template (as well as looking under the hood) CMSMS uses Smarty for its templates. I haven't worked with Smarty before, so that put me in pretty much the same position as when trying to create a template in Typo3. Only, Smarty apparently uses a mixture of HTML and pseudo-PHP, so the learning curve is a lot less steep. It took me all of 20 minutes to copy in the HTML I already had for PL PHP and put the replacement markers in the proper spots. That gave me basic template structure:

{process_pagedata}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
 <title>{sitename} - {title}</title>
 {metadata}
 {stylesheet}
</head>
<body>

 <div id='main_frame'>
 <!-- start header -->
  <div id='header'>
   <div id='logo'>
    <div id='logo_text'><a href='/'>{sitename}</a></div>
   </div>
   <!-- start menu -->
   <div id='menu'><span class='splitter'>&nbsp;</span>
    {menu}
   </div>
   <!-- end menu -->
  <div class='float-clear'></div>
 </div>  
  <!-- end header -->
  <!-- start content -->
  <div id="content">
   <h1>{title}</h1>
  {content}
  </div>
  <!-- end content -->

  <!-- start footer -->
  <div id='footer'>
 &copy; 2009 Peter Lind<span class='splitter'>&nbsp;</span>PL PHP<span class='splitter'>&nbsp;</span>
  </div>
 <!-- end footer -->
 </div>
</body>
</html>

As should be visible, most of the template is just straightforward HTML. The rest is fairly self-explanatory as well, given the names used for the placeholders: menu, content, metadata, stylesheet, etc. What actually goes into those placeholders? A quick test shows it's pretty much what you'd expect - which means, the next steps are reduced to making sure the right content is output.

Next is taking care of the stylesheet. This is more or less the same procedure as with the template: create a new stylesheet, copy the contents from the already created version, then set the media type and submit. Before you can actually see the changes made by the new template and stylesheet, you'll need to set both as default for the pages. This is done through the Templates and Stylesheets menupoints, point and click. One thing to remember is you need to set the template as default and set the pages you already have created to your new template. Otherwise you'll either not see current pages using the new template or not see new pages using it.

At this point, the site has working template and stylesheet. The menu is still all out of whack and the content needs to be fixed, so next up is looking at generating a menu. This is handled under Layout -> Menu Manager and once again, you click the button to create new, then start filling in details. Here though, you'll be working from nothing so copying an existing menu structure and modifying can make it easier.

This was probably the part that took the longest, as it makes the most use of Smartys pseudo-php. The menu structure I use for PL PHP is fairly simple though, so it was mainly a question of analyzing the existing setup and then taking the parts I needed. It came out like this:

{if $count > 0}
 {foreach from=$nodelist item=node}
  {if $node->current}
  <a href='{$node->url}' class='active-menupoint' title='{$node->menutext}'>{$node->menutext}</a>
  {else}
  <a href='{$node->url}' title='{$node->menutext}'>{$node->menutext}</a>
  {/if}
 <span class='splitter'>&nbsp;</span>
 {/foreach}
{/if}

If you know PHP you can guess what's going on here. If you don't, it might be somewhat confusing but probably not too much: node->url and node->menutext should give it away. It's just a basic loop over the pages, creating a link for each it finds.

After saving this part, you should once again remember to set it as default, as otherwise the menus won't be rendered using it. Having done that, my site now looks like it's supposed to - apart from actual content. This is handled from the Pages point in the Content menu. First part is to delete the existing pages, then create new ones with proper names and placing. Two minutes later, my site now has the proper content structure and I can get busy writing copy - using the ubiquitous TinyMCE editor.

One thing missing is the pretty urls. The setup for that is not as easy to find as the other things, so I turn to Google for some help, which instantly brings up some ok looking hits. The CMSMS wiki has the info needed, and it turns out that you just need to edit your config.php (specifically, setting \$config['url_rewriting'] to 'mod_rewrite') and add a .htaccess file that routes all requests to index.php. After that's done, CMSMS happily accepts pretty urls. And like with Typo3, you can change which urls are used for your pages - that's handled for each page individually when editing it (under the options tab).

Done

So, about three hours after I started implementing PL PHP in CMS Made Simple I have a working site looking the way I want it to, with pretty urls and what not. Although I am a PHP developer, I'm not sure if it would have been much harder for non-tech people - the interface is fairly intuitive. Especially if you're happy to go with the design provided by the default templates of CMSMS you'll be up and running with a site in very little time.

Comparing the experience to that of Typo3 this was easy on a level Typo3 can only dream of - but probably don't.

social