After having decided that I wanted to create this DevLog I had to decide how I wanted to create it. Initially I was set on creating my own content management system (or CMS for short) since I've never been too fond of the ones I've used in the past. I feel that most CMS' fall into one of two categories, either they are too restrictive in order to be as simple as possible, or they are too cumbersome as they try to give the ability to create everything. Managing a site with 50 different plug-ins and hundreds of various small parts to control everything through a GUI is not my description of a fun time. It's no better being stuck with the other half and left wanting for that one single feature that you just can't seem to be able to add.
<cms:template title='DevLog' clonable='1' type='richtext'> <cms:pages masterpage="index.php" paginate='1' limit='5'> <div class="post"> <h1><a href="<cms:show k_page_link />"><cms:show k_page_title /></a></h1> <h3><cms:date k_page_date format='jS F Y' /></h3> <p> <cms:excerptHTML count='75' ignore='img'><cms:show post_body /></cms:excerptHTML> </p> <p class="readmore"><a href="<cms:show k_page_link/>">Read entire entry</a></p> </div> <hr/> <cms:if k_paginated_bottom> <div class="post"> <div class="readmore" style="text-align:left;"> <cms:if k_paginate_link_prev> <a href="<cms:show k_paginate_link_prev/>">Newer entries</a> </cms:if> </div> <div class="readmore" style="text-align:right;margin-top:-20px"> <cms:if k_paginate_link_next> <a href="<cms:show k_paginate_link_next/>">Earlier entries</a> </cms:if> </div> </div> </cms:if> </cms:pages>
The first cms:template tag is located at the top of the page and tells Couch that the title of these elements are DevLog of type richtext and clonable (which means that there are more than one entry, the sidebar is an example of content which is not clonable). After that the cms:pages tag tells the index.php page to show at most five entries in a paginated fashion. The rest is a modified version of the template I created where I replaced the static titles, content, links etc. with tags pointing to managed content. The last portion simply tells Couch how to show the pagination buttons. As you can imagine this is not too far from the original template code. In fact there are just about 20 tags added to my initial design for this page to work.
When the tags are added the rest is pretty straight forward. Open couch and it will automatically look through your pages and create the relevant database tables (it relies on MySQL), then it will show the relevant sections in it's user interface and allow you to start creating content using an integrated richtext editor complete with all the features you would expect. The content will then be automatically fetched whenever you load a web-page completing the Couch integration.