Here is an example of controller with some basic operations
class homeController extends appRain_Base_Core
{
// Controller Name
public $name = "Home";
public $dispatch = Array(
'preDispatchExclude' => array(),
'postDispatchExclude' => array()
);
/**
* Function Call before Page action method each time
*/
public function __preDispatch()
{
}
/**
* Function Call before Page action method each time
*/
public function __postDispatch()
{
}
/**
* Render Home page
* We have configure this page from
* URI_Manager >> Boot_Router
* to be Render as a starting page of the project
*/
public function indexAction($id = null)
{
/**
* Fetch data from static page manager and
* set Page Meta Information.
*/
$pageinfo = $this->staticPageNameToMetaInfo('home-page');
$this->set('pageinfo', $pageinfo);
/* Set value to template */
$this->set("selected", "home");
}
/**
* Create search result based on Definitions
* and call back functions.
*/
public function searchAction($srcstr = null, $page = 1)
{
/* Attach Addons and Set meta information */
$staticpage = $this->staticPageNameToMetaInfo('search');
/**
* Fetch all search data definition in definition
* for Information Set and Category set
*/
$srcstr = isset($this->post['ss']) ? $this->post['ss'] : $srcstr;
$srcData = App::Helper("Search")
->setSmartPaging(true)
->setPage($page)
->setLimit(5)
->setHLink($this->baseurl("/search/{$srcstr}"))
->Search($srcstr);
/* Overwrite page title */
$this->page_title = "{$srcstr} {$this->page_title}";
/* Set Search data */
$this->set('srcstr', $srcstr);
$this->set('srcarr', $srcData);
/* Set Common variables */
$this->set("section_title", "Search Reasult");
$this->set("selected", "search");
}
}