View Single Post
  #1 (permalink)  
Old 03-30-2007, 02:45 PM
asabi asabi is offline
Junior Member
 
Join Date: Mar 2007
Posts: 4
Default forwarding how to use ?

Hi All,

I am new to the framework, so please, go easy on me ;-)

I am trying to do the following:

I have a module called "admin", inside admin, I have 4 controllers:

"wrapper" with "showHeader" and "showFooter" actions
"category" with "add" action
"disk" with "add" action
"index" with "index" action

What I'd like to do:

from the index/index action:

$this->_forward('showHeader','wrapper');
echo($viewHome->render('home.php'));
$this->_forward('showFooter','wrapper');

from the ctegory/add action:

$this->_forward('showHeader','wrapper');
echo($viewCategoryAdd->render('addCategory.php'));
$this->_forward('showFooter','wrapper');

from the disk/add action:

$this->_forward('showHeader','wrapper');
echo($viewDiskAdd->render('addDisk.php'));
$this->_forward('showFooter','wrapper');


The idea is to request for the header, the main content, and the footer, by just forwarding the request, and later continue with the rest of the action.

What I get in the default controller is:

the content of home.php, and the footer, but nothing from the header.

If I remove the footer call, I get the content, and header (in that order - I thought that I should get the header first, and the content later).

Am I making any sense here ? or am I missing the whole thing ?
Shouldn't the forward forward the request, and later continue from the caller ?

Is there a better, different way to get this working ?

HELP :-)

Last edited by asabi : 03-30-2007 at 03:11 PM.
Reply With Quote