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. |