Do It Yourself CMS » Blog »

New DiY-CMs features 2: adding code to templates and imporving update system

  By: admin   tags Date Added: Wednesday 09-02-2011

In my last blog I talked about the new updates that I developed for DiY-CMS. I talked about the cache system and in this blog I will be talking about the other two new improvements, namely: adding php code to main templates and improving the update system in the control panel.

One of the most needed features was to allow code to be inserted and parsed into templates of DiY-CMS themes. Adding code provides great flexibility for designing creating dynamic themes. I have changed the way that main templates are parsed within DiY-CMS. Eval() function is no longer used for parsing as it is frowned upon by many developers due to security risks it might poses as well as its inability to parse PHP code inside templates (in the case of DiY-CMS) without number of unnecessary modifications to the CMS.

So what is the benefit of enabling code parsing within main templates? The main advantage is that creating theme would be easier and more dynamic. For instance one could use condition statements (one of the common used statements in themes) to change a colour, a column or practically anything else. One can even add functions or any snippet of code he might like to the theme that he is creating. The second advantage is that I am working of developing theme settings in which this change comes in handy. Meaning that a designer would add settings to his theme, these settings can be modified by a general user through an interface and the designer will incorporate PHP code to modify the look and feel of the theme based on these settings.

Since now PHP code is accepted within main templates one can use the standard PHP file inclusion function rather than DiY-CMS style, for instance to include the file ‘blocks/tags.block.php’ instead of using:

<!--INC dir="blocks" file="tags.block.php" -->

One could use this style:

<?php include('blocks/ tags.block.php'); ?>

I have mentioned earlier that eval() function is no longer used, and that means that variables inside the main templates will not be rendered correctly (variables are the words preceded by the dollar sing $). For example $index_middle will not render correctly and it needs to be enclosed by php tags like so:

<?php echo $index_middle; ?>

I have updated all the themes in the download center to conform to the new system, and – hopefully – you would not have problems installing or running them on your website.
The second update I will be taking about in this blog is the improvement of the update system in the control panel. I have made number of improvements to the underlying code of the system and modified it to retrieve data in JSON format from DiY-CMS official website. This will allow for a more efficient and smooth process of updates. Also I improved the system to accept ZIP files. Using this feature the website administrator would be able to install a bunch of updates in one click. In order for this feature to work you need the ZIP Library installed on your hosting server. It is mostly installed, but if it is not you can ask your hosting to install it for you.
I wish that these features would be in great help for all the user of DiY-CMS, and I hope to hear your opinions in the comments.

Tags: updates, features, php-code More details

New DiY-CMS documentation and admin area tutorials

  By: admin   tags Date Added: Friday 16-04-2010

I have two updates in this post.
First, I have added a doucumentation for DiY-CMS 1.0 using phpDocumenter. It prases comments within files and in order to gnerate documentation.
I have commented most of the files, classes and functions of the DiY-CMS execpt for the modules part which hopefully I will be commenting in the future and then upload it to the documentation.

Docuemntation can be found at:

I divided DiY-CMS into four packages:
Global: includes the main classes in the cms.
Modules: includes all the files in the modules folder.
Admin: Includes all main classes in the admin folder.
Admin Sections: Includes all files under the admin section folder in the admin area.

The style of comment will be used as the standard style of commenting files, classes or functions. For any one who is intrested to delvope additions to cms use this style.
At the page level and for classes, use this style:

* Short description of the file.
* Long desciption: you have to leave an empty line before and after this description.
* @package Name of the pacakge
* @subpackage Name of Subpackage
* @author Authour name
* @copyright Copyright notice
* @version Version Number

To comment a function you might use this style:
* Short description of the file.
* Long desciption: you have to leave an empty line before and after this description.
* @param parameter type Description of parameter. You can add as many as lines as much parameters you have in the function

* @return return type Type of the returned values

You can use other tags recognised by phpDocumenter, but I have included the minimum.

Second update is that uploaded three tutorials explaining settings and module parts of the admin area:
1- Configuring general settings in admin area

2- Modules managment, part 1

3- Modules managment, part 2

All the videos are recodered using HD.

I hope these updated will help anyone who uses DiY-CMS to make them navigate easily throught the cms. If you have any comments about the tutorials or doucmentation please do not hestiate to tell me.

Tags: diy-cms, cms, updates, phpdocumenter, documentation, tutirals, videos More details

2 3 > »