I have been working on a simple php mvc framework and its going pretty well i have just been given permission to integrate a ActiveRecord class into it and have redone some routing and such but one thing that is bugging me is a better way to calling the show() function for templates.
Just now a view is called like so
And well i would rather have it not need a return or perhaps some logic to handle all the returns in the init() function(which is brand new to the controller templates and i have not sorted its full porpoise yet in the code).
So what i be asking is if its possible to call a return like this without writing it into the function.
The show is populated in the template by the class name = view folder, action name = view file, class name present = layout template.
Maybe something like this but without having to write the $this->init part.
Just now a view is called like so
PHP:
<?php
# Author: jerryrjroy
# Name: aboutController
# Version: 1.0
Class indexController Extends Cabbit_Controller_Action
{
# Initialisation function
private function init()
{
}
# /index/
# /index/index
public function index()
{
return $this->Cabbit->Template->show();
}
}
And well i would rather have it not need a return or perhaps some logic to handle all the returns in the init() function(which is brand new to the controller templates and i have not sorted its full porpoise yet in the code).
So what i be asking is if its possible to call a return like this without writing it into the function.
The show is populated in the template by the class name = view folder, action name = view file, class name present = layout template.
Maybe something like this but without having to write the $this->init part.
PHP:
Class indexController Extends Cabbit_Controller_Action
{
# Initialisation function
public function init()
{
return $this->Cabbit->Template->show();
}
# /index/
# /index/index
public function index()
{
$this->init();
}
}