Skip to content
This repository has been archived by the owner on Nov 24, 2019. It is now read-only.

v1 Admin controller

vee w, edited this page May 1, 2014 · 2 revisions

Admin controller use theme layout just like frontend controller.

'The content template' theme file will be call and put into 'the page template'.

The blue area is 'the page template' which is whole page template. It is start from doctype until </html>

To do this you have to extend controller to \Controller_AdminController

Example:

class Controller_Post extends \Controller_AdminController 
{
    public function action_index() 
    {
        // set head output here (title, meta, link, js)
        $output['page_title'] = $this->generateTitle('Posts management');

        return $this->generatePage('admin/templates/post/post_v', $output, false);
    }
}

From the example above. the view of this controller->method is in public/themes/<theme_name>/admin/templates/post/post_v.php

The $output variable is for easily to understand that it will be work with views, or theme and $data will be use with data base actions (insert/update/delete/select).

generateTitle method is for generate that page name with site name

generateTitle($title, $name_position = 'last');

$title is title name of current page

$name_position can be 'first' or 'last'

Example:

$this->generateTitle('page name', 'first'); // return "site name | page name"
$this->generateTitle('page name', 'last'); // return "page name | site name"