Mara cms blog interface

theme design for blogging

Base requirements

In principle, any existing theme can be modded into a blog layout. The required additions are:

That is really all that's needed for a very straightforward blog. Plus a few pages which declare this theme in an cms_theme meta tag, of course. One such page will be named index.php or index.htm(l) and will act as the table of contents, displaying a precis of each article. Other pages will display articles in full.

Additional features

Typical blogs might contain a dropdown menu of available articles, and a 'blogroll' in a separate column from the article content  These features are provided through additional menu files in the sitecfg/ directory. They are used in much the same way as the main dropdown menu, by making a call to the standard Mara cms menu plugin with the relevant blog feature as the filename. The article menu is automatically updated by each call to blog_catalog(), whilst the blogroll menu is manually created by the webmaster since it is essentially static in nature.  You will likely want to enclose these menus in their own div with a distinct class or ID, since the required css styling is likely to differ somewhat from that of the main site menu. Styling goes into theme.css as usual, and you will note that a blogging theme's theme.css has a few extra sections over those of a static site for this reason. 

Since these items are Mara cms menus, it stands to reason that you don't have to place them in a righthand bar; they can be placed as a dropdown in a top banner, or anywhere else you can place a menu.

A 'Recently Visited' list is provided through a cms_history() function, a call to which outputs the list in menu format. This function was made a part of the main Mara cms code since it may also be useful on non-blog pages.  Since it must maintain a running list of pages visited by each individual site visitor, it makes use of the browser session cookie and array rather than a common menu file. A consequence of this mode of working is that the recent list cannot survive a php session timeout where the browser is left inactive (or the computer in standby) for an extended period. However, it provides an elegant solution to providing visitor-specific information without violating the EU persistent-cookie notification directive.


The distribution contains the blog and blog2 themes. The former uses the straightforward unordered list approach, with any images present being placed in righthand float alongside the relevant article. The latter uses the more advanced serialized array approach, thus the formatting code is in theme.php itself. In this case a tabular layout is used to give a more regularly-spaced set of items. The actual markup is entirely up to you, and if wish you can use HTML5's document section syntax here. 


If you don't want site visitors to inappropriately select your blog's theme when viewing mainsite content, then name the theme starting with a period. -as is standard linux convention for hidden files. In the distribution this has not been done, since it may be useful to observe the effect of using a blog theme on the main content. You will notice that apart from some unsuitable first paragraphs it works remarkably well, in spite of the content never having been intended for a blog. 


Recently Visited
Related Pages
Blog index page Another index style Mara CMS Home IWR Consultancy Sourceforge Page
Powered by Mara cms