Ver Mensaje Individual
  #13 (permalink)  
Antiguo 23/07/2010, 15:06
Avatar de RIVERMILLOS
RIVERMILLOS
 
Fecha de Ingreso: marzo-2010
Mensajes: 1.336
Antigüedad: 14 años, 1 mes
Puntos: 15
Respuesta: Duda sobre funcionamiento Zend

Espera que me perdi XD


mira este es el controlador que me recibe los numeros.

Código:
<?php

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
     /* Initialize action controller here */
    }

    public function indexAction()
    {
      
	  
    $form = new Zend_Form();
    $form->setAction('http://127.0.0.1/ZF/public/index/validar');
    $form->setEnctype('multipart/form-data');
    $form->setMethod('post');
    $form->addElement(
    'text',
    'num1',
    array('required' => true, 'label' => 'Numero1')
     );
     $form->addElement(
     'text',
    'num2',
     array('required' => true, 'label' =>'Numero')
     );
     $form->addElement('submit', 'Sumar', array('label' => 'Sumar'));
     echo $form;					
    
	 }

    public function validarAction()
    {
		
      $num1= (int)$this->_getParam('num1');
 
      $num2 =(int) $this->_getParam('num2');
  
      echo $num1+num2;

    }
}

?>
este funciona bn ya puedo sumar.

este es mi layout

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Demo</title>
<?php
$this->headLink()
->appendStylesheet('http://127.0.0.1/ZF/public/css/global.css');
echo $this->headLink();
$this->headScript()->appendFile('http://127.0.0.1/ZF/public/js/jquery.js');
$this->headScript()->appendFile('http://127.0.0.1/ZF/public/js/global.js');
echo $this->headScript();
?>
</head>
<body>
<div id="contenedor">
<?php
echo $this->layout()->content;
?>
</div>

<div id="resultados">

</div>

</body>
</html>
pero no me lo imprime en el div resultados me lo imprime antes de que cierre el body a eso me refiero.

saludos