Hybrid Controller

The hybrid controller brings together the functionality of both the REST controller and the Template controller in a single base controller.

For more information about the Template or Rest functionality, see the Controller_Rest or Controller_Template pages.

Like all Controllers, you create a class in the fuel/app/classes/controller directory. They need to extend the Controller_Hybrid class and are prefixed by default by "Controller_". Below is an example of the controller "test":

class Controller_Test extends Controller_Hybrid
{
	// this will be called if you request /test/list from the URL
	public function action_list()
	{
		$this->template->content = 'Hello World!';
	}

	// this will be called when you do an ajax GET request for /test/list?foo=bar
	public function get_list()
	{
		$this->response(array(
			'foo' => Input::get('foo'),
			'baz' => array(
				1, 50, 219
			),
			'empty' => null
		));
	}
}