Hola yo otra vez! Gracias por responder estuve probando pero no me resulto... Te muestro lo que hice en el index.php coloque:
Código php:
Ver originalrequire_once 'Zend/Layout.php';
Zend_Layout
::startMvc(array('layoutPath' => ROOT_DIR
.'/application/layouts/scripts'));
// Run!
$frontController = Zend_Controller_Front::getInstance();
$frontController->addControllerDirectory(ROOT_DIR.'/application/controllers');
$frontController->throwExceptions(true);
/*try {
$frontController->dispatch();
} catch(Exception $e) {
echo nl2br($e->__toString());
}*/
el layout tiene:
Código php:
Ver original<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl();?>/css/grid.css" />
<?php //echo $this->headLink()->appendStylesheet('/css/grid.css') ?>
<?php echo $this -> headTitle () ?>
<?php echo $this -> headScript () ?>
<?php echo $this -> headStyle () ?>
</head>
<body>
<div id="bcss-header"> <?php echo $this->render ( 'header.phtml' ) ?> </div>
<div id="nav"> <?php echo $this -> placeholder ( 'nav' ) ?> </div>
<div id="bcss-sidebar-1"> <?php echo $this->render ( 'sidebarLeft.phtml' ) ?> </div>
<div id="bcss-content"> <?php echo $this -> layout ()-> content ?> </div>
<div id="bcss-sidebar-2"> <?php echo $this->render ( 'sidebarRight.phtml' ) ?> </div>
<div id="bcss-footer"> <?php echo $this -> render ( 'footer.phtml' ) ?> </div>
</body>
</html>
creer un controlador con esto:
Código php:
Ver original<?php
class HeaderController extends Zend_Controller_Action
{
public function init()
{
// Render sidebar for every action
$response = $this->getResponse();
$response->insert('header', $this->view->render('header.phtml'));
//$this->view->title = 'Validación';
}
public function headerAction()
{
$this->view->title = 'Validación';
$a=2;
$b=3;
$suma=$a+$b;
$this->view->suma = $suma;
}
}
el header.phtml tiene:
Código php:
Ver original--------------------------------------------------------------------------
<b>Fecha:</b>
<?php echo date('d-m-Y'); ?>--------------------------------------------------------------------------
<?php echo $this->suma; ?>
Nota: la fecha si me la muestra pero la suma no.
y cree el plugin que se encuentra en los controladores
Código php:
Ver original<?php
class MyPlugin extends Zend_Controller_Plugin_Abstract {
protected $_stack;
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
$stack = $this->getStack();
$menuRequest = new Zend_Controller_Request_Simple();
$menuRequest->setControllerName('header')
->setActionName('header');
$stack->pushStack($menuRequest);
}
public function getStack()
{
if (null === $this->_stack) {
$front = Zend_Controller_Front::getInstance();
if (!$front->hasPlugin('Zend_Controller_Plugin_ActionStack')) {
$stack = new Zend_Controller_Plugin_ActionStack();
$front->registerPlugin($stack);
} else {
$stack = $front->getPlugin('ActionStack');
}
$this->_stack = $stack;
}
return $this->_stack;
}
}
Pero igual sigue sin mistrarme lo que quiero....
Disculpa tanta molestia, Gracias nuevamente
sera que me falta algo???...