Retroceder   Foros del Web > Programación para sitios web > AJAX

Respuesta
 
Herramientas Desplegado
Antiguo 19-jul-2006, 11:14   #1 (permalink)
zsamer tiene algunos puntos positivos de karma
 
Fecha de Ingreso: noviembre-2003
Mensajes: 786
Problema con xajax+smarty+web mudular

Hola,

Uso suse linux y firefox.
Mi programacion en php es modular con smarty, y quiero implementar xajax para ciertas cosas, tengo un modulo llamado galeria, el cual se estructura de la siguiente manera:

url: http://localhost/inmob/index.php?modulo=galeria

index.php
Código PHP:
function principal(){

}

function 
xxx(){

}

function 
yyy(){

}

function 
zzz(){

}

switch(
$accion) {
   case 
"xxx":
    
xxx();
    break;
   case 
"yyy":
    
yyy();
    break;
   case 
"zzz":
    
zzz();
    break;
    default:
    
principal();
    break;

el problema es cuando quiero implementar xajax dentro de la función zzz()
es decir:
Código PHP:
function principal(){

}

function 
xxx(){

}

function 
yyy(){

}

function 
zzz(){

require_once(
"includes/xajax/xajax.inc.php");
$xajax = new xajax();
$xajax->debugOn(); // Uncomment this line to turn debugging on
$xajax->statusMessagesOn();
$xajax->registerFunction("MuestraImagen");
$xajax->processRequests();
//$xajax->printJavascript();
$smarty -> assign('xajax_javascript',$xajax->getJavascript('includes/xajax/'));

}

function 
MuestraImagen($image)
{
    require_once(
"includes/xajax/xajax.inc.php");
    
// do some stuff based on $arg like query data from a database and
    // put it into a variable like $newContent
    
$newContent  "<A HREF=\"javascript:popUp('modulos/galeria/images/$image')\" TITLE=\"Ver a tamano completo\">";
    
$newContent .= '<img  border=0 src="modulos/galeria/genthumbs.php?image='.$image.'&w=225" alt="'.$txtalt.'"><br>'.$descripcion.'<br><br>';

    
// FIN IMAGEN GRANDE    
    // Instantiate the xajaxResponse object
    
$objResponse = new xajaxResponse();
    
    
// add a command to the response to assign the innerHTML attribute of
    // the element with id="SomeElementId" to whatever the new content is
    
$objResponse->addAssign("SomeElementId","innerHTML"$newContent);
    
    
//return the  xajaxResponse object
    
return $objResponse;
}
$accion=$_REQUEST['accion'];
switch(
$accion) {
   case 
"xxx":
    
xxx();
    break;
   case 
"yyy":
    
yyy();
    break;
   case 
"zzz":
    
zzz();
    break;
    default:
    
principal();
    break;

no me funciona, mi duda es que la funcion "MuestraImagen" (de xajax) tiene que ir dentro o fuera de la funcion zzz.

me muestra una ventana el siguiente mensaje:

Código:
error: the XML response that was returned from the server is invalid.
Received:
<html>
<head>
etc...
gracias por cualquier ayuda.

Última edición por zsamer; 19-jul-2006 a las 11:25.
zsamer está desconectado   Responder Citando
Respuesta

No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 07:14.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93