I had something similar but still wanted to keep the shared layout but
change the layout on special pages.
 
Here is what I did.

In the Initializer class :

// Bootstrap layouts
Zend_Layout::startMvc(array(
'layoutPath' => $this->_root . '/application/library/layouts',
'layout' => 'layouttemplate1'
));

In my action function of the controller :

// change layout inside controller action
Zend_Layout::getMvcInstance()->setLayout('layouttemplate2');

// change layout path (if needed)
// Zend_Layout::getMvcInstance()->setLayoutPath('different path to layout
here');

Terre


________________________________

From: Ahmed Abdel-Aliem [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 30, 2008 9:49 AM
To: Zend Framework General
Subject: [fw-general] Re: changing layout path problem


i figured it out
thanks for the guys in the IRC

i renamed initView to preDispatch and that solved it.


On Thu, Oct 30, 2008 at 2:48 PM, Ahmed Abdel-Aliem <[EMAIL PROTECTED]>
wrote:


        Dear All
        
        i have a problem setting the layout of different modules in the
initializer.php 
        
        in the old version of the framework that was no problem because i
define the path for each module in its bootstrap
        
        but no i cant do that
        
        so i tried to do the following
        
            public function initView()
            {
                // Bootstrap layouts
                Zend_Layout::startMvc(array(
                    'layoutPath' => $this->_root .
'/application/'.$this->getRequest()->getModuleName().'/layouts',
                    'layout' => 'main'
                ));
                
            }
        
        
        but it couldn't recognize the module name.
        
        any idea how i can fix that ??
        
        
        -- 
        Regards, 
        Ahmed Abdel-Aliem 
        Senior Web Developer 
        Aroma Designs & Solutions
        http://systems.graphicaroma.com
        
        Blog : http://www.php-architect.com/blog 
        
        Acting by Reacting : By not printing this e-mail I help protect the
environment.
        




-- 
Regards, 
Ahmed Abdel-Aliem 
Senior Web Developer 
Aroma Designs & Solutions
http://systems.graphicaroma.com

Blog : http://www.php-architect.com/blog 

Acting by Reacting : By not printing this e-mail I help protect the
environment.


Reply via email to