Ver Mensaje Individual
  #9 (permalink)  
Antiguo 15/02/2011, 08:49
CyberMauher
 
Fecha de Ingreso: febrero-2010
Mensajes: 183
Antigüedad: 14 años, 3 meses
Puntos: 1
Respuesta: $view->assign('var', 'contenido') en IndexController

Cita:
Iniciado por abimaelrc Ver Mensaje
Exacto, es como dice master, por eso te pregunto que tienes en la variable $view porque dependiendo de lo que digas se te puede decir que corregir. Si colocas el codigo completo mejor de ese action.
Dejo el código PARTE #1:

Bootstrap.php
Código PHP:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function 
_initView()
    {
        
setlocale(LC_TIME'es_ES.UTF-8');
        
        
// Inicializar la vista
        
$view = new Zend_View();
        
$view->doctype('XHTML1_STRICT');
        
         
// setting the controller and action name as title segments:
        
$view->headTitle('SGContable');
        
        
$view    ->    headMeta()
                    ->    
appendHttpEquiv('Content-Type''text/html; charset=UTF-8')
                    ->    
appendHttpEquiv('Content-Language''es-AR');
                    
        
$view    ->    headMeta()
                    ->    
appendName('google-site-verification''BIiK77mwkJeGjib6uubYJIb8vjmP-8DJE59UebQodOM')
                    ->    
appendName('DC.Language''spanish', array('scheme' => 'RFC1766'))
                    ->    
appendName('AUTHOR''Yo')
                    ->    
appendName('REPLY-TO''[email protected]')
                    ->    
appendName('DESCRIPTION''Descripción.')
                    ->    
appendName('KEYWORDS''keywords')
                    ->    
appendName('Resource-Type''document')
                    ->    
appendName('Revisit-After''1 days')
                    ->    
appendName('Robots''all')
                    ->    
appendName('google-site-verification''xxxx');
        
        
$view    ->    headLink()
                    ->    
headLink(array(
                                
'href' => 'imgs/favicon.ico'
                                
'rel' => 'shortcut icon'
                                
'type' => 'image/x-icon'
                            
))
                    ->    
headLink(array(
                                
'href' => 'mailto:[email protected]'
                                
'rev' => 'made'
                            
));
                            

        
$view->addHelperPath('ZendX/JQuery/View/Helper/''ZendX_JQuery_View_Helper');
        
$view->headScript()->appendScript($script);
        
$view->headScript()->appendScript('var IE7_PNG_SUFFIX = ".png";''text/javascript', array('conditional' => 'lt IE 9'));
        
$view->headScript()->appendFile('js/IE9.js''text/javascript', array('conditional' => 'lt IE 9'));
        
        
// Añadir al ViewRenderer
        
$viewRenderer Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
        
$viewRenderer->setView($view);
        
        
// Retorno, de modo que pueda ser almacenada en el arranque (bootstrap)
        
return $view;
    }

IndexController.php
Código PHP:
class IndexController extends Zend_Controller_Action
{
    public function 
init()
    {
        
/* Initialize action controller here */
        
$view $this->initView();
        
$view->headTitle('Inicio');
        
$view->headTitle()->setSeparator(' / ');
    }
    
    public function 
indexAction()
    {
        
// action body
        
$view $this->initView();
        
$view->setEscape('htmlentities');
        
$view->assign('mensaje''FUCKING MESSAGE!!!');
    }
    
    public function 
initView()
    {
        if (
Zend_Registry::isRegistered('view')) {
            
$this->view Zend_Registry::get('view');
        } else {
            
$this->view = new Zend_View();
        }
        
        return 
$this->view;
    }

layout.phtml
Código:
<?php echo $this->doctype(); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<?php
	echo $this->headTitle().PHP_EOL;
	echo $this->headMeta().PHP_EOL;
	echo $this->headLink().PHP_EOL;
	$this->jQuery()
		->setCdnSsl($_SERVER['HTTPS'])
		->enable()
		->setVersion('1')
		->uiEnable()
		->setUiVersion('1');
	echo $this->jQuery().PHP_EOL;
	echo $this->headScript().PHP_EOL;
	?>
</head>
<body>
	<?php echo $this->layout()->content; ?>
	<?php echo $this->escape($this->mensaje); ?>	
</body>
</html>