Please click here if you are not redirected within a few seconds.
CMS Categories › shanebow.com
CMS Categories

Site Categories are the way we organize the site into a hierarchy of web pages. Each category may contain sub-categories, pages, or a combination of both. And the pages may be static or dynamic. The ShaneBow CMS category module, stores the categories using the nested set model.

We create and maintain the categories in the Admin section of the site using the Category Manager. Then we offer various ways to use these categories to traverse the web site, including:

Model

Category Metadata

Tron Image

For sirijanda.com we like tron dimensions of 1280x488 == 960x366

Controllers

Page -

The Page controller controls the front end. There are some different ways to display the contents of a category.

Views

admin

cms-cat-manager.php.content
!layout:admin
<title>Categories</title>
~~cms/cats/ui/admin/cat-manager.view

old Mblogs

The old blog_cats table was just a flat list of blog categories. This is superseded by the new cats table which stores all site categories in a tree structure that includes the blog categories as one branch.

To ease the migration to the new style, we can keep the blogs branch to a single level — Then fetching this branch can return a flat list similar to the old mblogs->get_cats(), below, which is pervasive in the Blog controller: .

    public function get_cats($fields='cats.id,name,icon,cats.slug') {
        return $this->db
            ->select($fields.',COUNT(blogs.cid) as numblogs')
            ->join('blogs', 'blogs.cid = cats.id','left outer')
            ->group_by('cats.id')
            ->get('blog_cats cats')
            ->result_array();
        }

UI Category Tree (sidebar)

<div class="panel cattree" >
 <h3>Categories</h3>
 <ul class="tree">
  <?= file_get_contents('assets/files/cattree2.div') ?>
 </ul>
</div>