por favor ayudenme este es mi script para diferentes layouts
Código PHP:
//application/default/plugins/Layout.php
<?php class Plugin_Layout extends Zend_Controller_plugin_Abstract{
public function preDispatch(Zend_Controller_Request_Abstract $request){
$config = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOptions();
print_r($config);
$moduleName = $request->getModuleName();
echo 'nombre modulo: '.$moduleName.'<br>';
/*if (isset($config[$module]['resources']['layout']['layout'])) {
$layoutScript = $config[$module]['resources']['layout']['layout'];
print_r($layoutScript);
$this->getActionController()
->getHelper('layout')
->setLayout($layoutScript);
} */
if (isset($config[$moduleName]['resources']['layout']['layout'])) {
echo 'en el if ';
$layoutScript = $config[$moduleName]['resources']['layout']['layout'];
Zend_Layout::getMvcInstance()->setLayout($layoutScript);
print_r($layoutScript);
}
if (isset($config[$moduleName]['resources']['layout']['layoutPath'])) {
$layoutPath = $config[$moduleName]['resources']['layout']['layoutPath'];
$moduleDir = Zend_Controller_Front::getInstance()->getModuleDirectory();
Zend_Layout::getMvcInstance()->setLayoutPath($layoutPath);
}
}
}
?>
y este el la llamada del plugin en el bootstrap
Código PHP:
<?php
class User_Bootstrap extends Zend_Application_Module_Bootstrap
{
protected function _initAutoLoad() {
$modelLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'user',
'basePath' => APPLICATION_PATH . '/modules/user'));
return $modelLoader;
}
protected function _initPlugins(){
$this->bootstrap('frontController');
$plugin = new Plugin_Layout();
$this->frontController->registerPlugin($plugin);
}
cuando quiero autentificarme o hacer alguna oprecaion me da el siguiente error:
Fatal error: Uncaught exception 'Zend_Controller_Response_Exception' with message 'Cannot send headers; headers already sent in C:\xampp\htdocs\modularizacion\application\modules \default\plugins\Layout.php, line 2' in C:\xampp\php\PEAR\Zend\Controller\Response\Abstrac t.php:282 Stack trace: #0 C:\xampp\php\PEAR\Zend\Controller\Response\Abstrac t.php(300): Zend_Controller_Response_Abstract->canSendHeaders(true) #1 C:\xampp\php\PEAR\Zend\Controller\Response\Abstrac t.php(727): Zend_Controller_Response_Abstract->sendHeaders() #2 C:\xampp\php\PEAR\Zend\Controller\Front.php(984): Zend_Controller_Response_Abstract->sendResponse() #3 C:\xampp\php\PEAR\Zend\Application\Bootstrap\Boots trap.php(77): Zend_Controller_Front->dispatch() #4 C:\xampp\php\PEAR\Zend\Application.php(358): Zend_Application_Bootstrap_Bootstrap->run() #5 C:\xampp\htdocs\modularizacion\public\index.php(26 ): Zend_Application->run() #6 {main} thrown in C:\xampp\php\PEAR\Zend\Controller\Response\Abstrac t.php on line 282
que estoy haciendo mal ayudenme,les esare agradecidos