Agile Toolkit news

library updates, tips, information and more

Lightweight CMS in ATK (video)

As my designer says – best way to break a great web design is to give CMS access to the client. Without any consideration for style they will star moving things around and break stuff. Often not willing to pay for a proper update they will continue to tweak themselves. So what’s the alternative?

There is some – contextual editing. In this post i’ll show how you can do it in ATK

I have implemented it for our upcoming homepage design. It consists of multiple blocks of data with short and precise explanations. We do want to give power to edit text to our content guys, but we don’t want them to break layout.

So we decided to make a light-weight CMS. Here is a video how it works:

We started by adding a new keyword into our page templates, <?editable?>. The first word inside that block is treated as a “content-key”. The rest is default content. Designer is free to add as many content areas as he wishes to. They can come in all shapes and sizes and developer is not even involved, it’s just a template tweak.

SMlite have a function called eachTag(). It’s suitable in cases where you have same tag appearing multiple times in the template such as this. We use id to call a function which substitutes content if a better version is defined in the database. It also makes content clickable and even adds a pinkish layer on hover.


Inside the function we need to first load the new content if it already have been re-defined:



Since we will be using this area with JavaScript we need to establish ID for it:

$content='<div id="'.$e.'">'.$content.'</div>';

When double-clicked, we want this area to spawn a new dialog and pass on information about key as well as default content:


We also want to highlight the box, but only if user is logged in:


That’s all we need to do. This code goes to ancestor of all our pages (AWPage). We then need to set up a page for admin/content. If you are familiar with ATK you should have no problems making it, but here is the code just in case:

class page_admin_content extends AdminPage {
	function init(){






But oh wait – we have integrated wymeditor into our system. Was that difficult? No. It took two lines of code instead of one (like with all those jQurey addons)

					'<script type="text/javascript" src="'.$url.'"></script>'."\n");

and drop default installation of wymeditor in one of the js install locations, no modifications required. Some other time I will post about those fancy effects we have on the popup windows.


June 4, 2010 - Posted by | Beginner tips, Version 3


  1. […] you have it. I also changed the template of the page to contain light-weight CMS before and after the […]

    Pingback by Checking password strength with CrackLib « Agile Toolkit news | July 26, 2010 | Reply

  2. […] you have it. I also changed the template of the page to contain light-weight CMS before and after the […]

    Pingback by Agile Toolkit news » Checking password strength with CrackLib | July 28, 2010 | Reply

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s