Custom controller

From SocialStrap Wiki
Revision as of 10:40, 25 March 2015 by Alcalbg (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In this tutorial we will create additional controller called 'custom' with a single action called 'hello'

Create a new file called app/core/controllers/CustomController.php with this content:


class CustomController extends Zend_Controller_Action

	 * Hello action
	public function helloAction()
		// switch to wide layout


Now we can create appropriate layout file to hold some html content app\core\views\layout\custom\hello.phtml

	Hello world!

We must allow access by adding this to the bottom of access control list constructor function app/core/plugins/AccessCheck.php

		// custom controllers, restore after updating
		$this->acl->addResource(new Zend_Acl_Resource('custom'))
		->addResource(new Zend_Acl_Resource('custom/hello'), 'custom')

		$this->acl->allow('guest', array(

Now point your browser to your new controller/action like this