Ver Mensaje Individual
  #10 (permalink)  
Antiguo 29/09/2009, 13:28
tucuguara
 
Fecha de Ingreso: septiembre-2009
Mensajes: 27
Antigüedad: 14 años, 7 meses
Puntos: 0
Sonrisa

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 original
  1. require_once 'Zend/Layout.php';  
  2. Zend_Layout::startMvc(array('layoutPath' => ROOT_DIR.'/application/layouts/scripts'));
  3.  
  4. // Run!
  5. $frontController = Zend_Controller_Front::getInstance();
  6. $frontController->addControllerDirectory(ROOT_DIR.'/application/controllers');
  7. $frontController->throwExceptions(true);
  8. /*try {
  9.     $frontController->dispatch();
  10. } catch(Exception $e) {
  11.     echo nl2br($e->__toString());
  12. }*/

el layout tiene:

Código php:
Ver original
  1. <html>
  2.  <head>
  3.      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4.      <link rel="stylesheet" type="text/css" href="<?php echo $this->baseUrl();?>/css/grid.css" />
  5.      <?php //echo $this->headLink()->appendStylesheet('/css/grid.css') ?>
  6.      <?php echo $this -> headTitle () ?>
  7.      <?php echo $this -> headScript () ?>
  8.      <?php echo $this -> headStyle () ?>
  9.  </head>
  10.  <body>
  11.      <div id="bcss-header"> <?php echo $this->render ( 'header.phtml' ) ?> </div>
  12.  
  13.      <div id="nav"> <?php echo $this -> placeholder ( 'nav' ) ?> </div>
  14.  
  15.      <div id="bcss-sidebar-1"> <?php echo $this->render ( 'sidebarLeft.phtml' ) ?> </div>
  16.  
  17.      <div id="bcss-content"> <?php echo $this -> layout ()-> content ?> </div>
  18.  
  19.      <div id="bcss-sidebar-2"> <?php echo $this->render ( 'sidebarRight.phtml' ) ?> </div>
  20.  
  21.      <div id="bcss-footer"> <?php echo $this -> render ( 'footer.phtml' ) ?> </div>
  22.  </body>
  23.  </html>

creer un controlador con esto:

Código php:
Ver original
  1. <?php
  2. class HeaderController extends Zend_Controller_Action
  3.  {
  4.     public function init()
  5.         {
  6.         // Render sidebar for every action
  7.         $response = $this->getResponse();
  8.         $response->insert('header', $this->view->render('header.phtml'));
  9.         //$this->view->title = 'Validaci&oacute;n';
  10.         }
  11.  
  12.     public function headerAction()
  13.     {
  14.         $this->view->title = 'Validaci&oacute;n';
  15.         $a=2;
  16.         $b=3;
  17.         $suma=$a+$b;
  18.         $this->view->suma = $suma;
  19.     }
  20. }

el header.phtml tiene:

Código php:
Ver original
  1. --------------------------------------------------------------------------
  2. <b>Fecha:</b> <?php echo date('d-m-Y'); ?>
  3. --------------------------------------------------------------------------
  4. <?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
  1. <?php
  2. class MyPlugin extends Zend_Controller_Plugin_Abstract {
  3.     protected $_stack;
  4.    
  5.     public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
  6.     {
  7.         $stack = $this->getStack();
  8.         $menuRequest = new Zend_Controller_Request_Simple();
  9.         $menuRequest->setControllerName('header')
  10.             ->setActionName('header');
  11.         $stack->pushStack($menuRequest);
  12.     }
  13.        
  14.     public function getStack()
  15.     {
  16.         if (null === $this->_stack) {
  17.             $front = Zend_Controller_Front::getInstance();
  18.             if (!$front->hasPlugin('Zend_Controller_Plugin_ActionStack')) {
  19.                 $stack = new Zend_Controller_Plugin_ActionStack();
  20.                 $front->registerPlugin($stack);
  21.             } else {
  22.                 $stack = $front->getPlugin('ActionStack');
  23.             }
  24.         $this->_stack = $stack;
  25.         }
  26.         return $this->_stack;
  27.     }
  28. }

Pero igual sigue sin mistrarme lo que quiero....

Disculpa tanta molestia, Gracias nuevamente

sera que me falta algo???...

Última edición por jam1138; 29/09/2009 a las 13:48