Two new blocks added in codefight cms - most popular entries and recent entries

Posted by Damodar Bashyal on September 06, 2009


Update: Below items has been added to codefight CMS version 1.1.3 which is available for download from google code. Also includes fixes of installer.

Today i have added two blocks in the core. Most popular entries which is based on page views. Every time a page is viewed, its counter increases by 1. So, the list is grabbed in a descending order i.e. most viewed to least viewed. There is an option to get number of lists you want to display. Default is 10 list.

And another block is recent entries. This is straight forward. And needs no explaination. The sorting is done according to page ID. In this one also you can pass amount to get number of listings. Default is 10 for this as well.

Currently limiting is pass through block only. I am planning to connect it to admin, so, its easy for non-programmers to easily select the number of entries to fetch from database.

Update 6th sep, 09: Yesterday i added above blocks and today i have updated comment section in frontend and admin. When adding comment now it adds current url as well. Previously i was having problem to find out which page they belong to. Now its easy to know the page, that comment is submitted. Not sure what to add next :) thinkinggggg.........


How to load a php block in your customised theme?

Posted by Damodar Bashyal on April 11, 2009


How to load a codefight cms block in certain area?

Since i started to code my cms, i have learnt new things and ideas. My latest addition is blocks. I have created blocks of different parts, or say features. This one is currently working for template view files. Because of this, its quite easy to build a new theme for codefight cms.

If you check the file tree image you will get some idea. Or, for more detail you can download the cms. This is how blocks are loaded in the area you want:


or, you can even load a different blocks with one call using array as:


How does TAG cloud works in Codefight CMS?

Posted by Damodar Bashyal on April 06, 2009


How does TAG cloud works in Codefight CMS?


In admin when creating page, if tags are set split tags separated with commas. Then clean up every tag for tag-key as $tag. Then insert the tags into tag clouds table.

$pages_tags = split(',',$pages_tags);
if(is_array($pages_tags) && count($pages_tags) > 0)
foreach($pages_tags as $v)
//clean tag
$tag = $this->data_model->link_clean($v);
//add|increment tag count
$this->data_model->tag_cloud_add($tag, 'page', $v);
//insert tags to tags table
$this->db->insert('pages_tags', array('pages_id' => $page_id, 'tags' => $tag));