views:

111

answers:

5

hi there when i build my web site it was handling only one interface but now i need to handle many interface

i can detect which site to communicate and isolate it from other sites but i stuck with this : all the sites have the same views ...

is there are a way so i can rander from the same controller different views .. something like

application

application
            controller
            model
            site_1_view
            site_2_view

is this possible ??!!

A: 
$this->view->render('script.phtml'); 

should work.

ArneRie
A: 

Or:

public function myAction() 
{
    return $this->otherAction();
}

public function otherAction() 
{

}
takeshin
steel i will redundant the actions between sites which is not my goal
S.Hawary
A: 

add a new scripts path to view LIFO stack

SM
A: 

Just an idea: detect what site is currently being viewed, and then tell Zend_View to use scripts for that specific site by setting $view->setScriptPath(/path/to/site1/scripts/);

Edit: I might be wrong on this one, but the best place to set this would be a controller plugin in the preDispatch method, as at that time, you would know what module/controller/action has been requested, but not yet dispatched: http://framework.zend.com/manual/en/zend.controller.plugins.html

robertbasic
A: 

it was very simple

$this->view->setBasePath("../application/site_1_view/views");

in the constrictor it work

in the public/index.php i detect the url and set it in session and detect the name from my DB and by name i do

$this->view->setBasePath("../application/".$siteName."/views");

and the application structure is now like:

 application
            controllers
            model
            site_1_view
                         views
                                scripts
                                         controllerName
                                                        ActionName 

            site_2_view
                         views
                                scripts
                                         controllerName
                                                        ActionName  
S.Hawary