FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
|||
|
|||
Template & Ajax
Saludos, he logrado que me funcionen los Templates con las acciones que se deben ejecutar, pero tengo un nuevo problema, ahora deseo que esas acciones se ejecuten con AJAX... sin el Template, el ajax funciona perfectamente, pero con el Template no funciona para nada...
si tienen respuesta, por favor... |
#2
|
|||
|
|||
Template & Ajax
Hola Rony,
Tengo el mismo problema y estoy buscando la solucion. Ni bien la encuentre te paso el dato Saludos, Luis |
#3
|
||||
|
||||
Perdón por la intromisión pero es que no tengo ni idea de AJAX aunque si tengo experiencia con (X)HTML, JavaScript y PHP. ¿Podéis explicar algo más el problema? ¿Lo de las templates son una característica inherente de AJAX?
Por otro lado sin código va a ser algo difícil... |
#4
|
|||
|
|||
Template & AJAX
Hola Ñuño MArtinez,
Primero gracias por tu atencion. Estoy haciendo una aplicacion con Delphi for PHP. Estoy usando el metodo ajaxcall() y tambien el smartytemplate que viene con el Delphi for PHP. Si uso ajaxcall() y no smartytemplate funciona. Si uso ajaxcall() y smartytemplate el metodo no funciona. Saludos, Luis |
#5
|
||||
|
||||
Ya pero, ¿qué no funciona? ¿No carga la página? ¿Muestra algún error? ¿Se queda bloqueado?
|
#6
|
|||
|
|||
Template & Ajax
Con Delphi for PHP, que es orientado a objetos, podes definir un evento de JS en un objeto (en este caso un boton) para que llame a una funcion en PHP sin hacer un submit. Para hacer tal funcionalidad es necesario usar el metodo ajaxcall("nombre de funcion").
Este metodo deja de funcionar cuando se utiliza la tecnica de SmartyTemplate (una pagina html se inserta en la pagina PHP dando formato a la pagina). Saludos, Luis |
#7
|
|||
|
|||
Solucionado
Saludos,
Aunque han pasado algunos meses desde el último mensaje publicado en este hilo, como al final no se dió ninguna solución pues lo retomo. Ayer me surgió el mismo problema: página que hace uso de ajax, pero que sólo funciona sin templates. Al parecer es un bug de D4PHP, pero en este enlace dan una solución: http://forums.delphi-php.net/showthread.php?t=730 Resumiendo: En el archivo vcl\forms.inc.php hay que sustituir las funciones dumpUsingTemplate() y dumpHeaderJavascript() por estas: Código:
function dumpUsingTemplate() { $this->processAjax(); //Check here for templateengine and templatefilename if (($this->ControlState & csDesigning) != csDesigning) { $tclassname=$this->_templateengine; $template=new $tclassname($this); $template->FileName=$this->_templatefilename; $template->initialize(); // I added the smarty object to the OnTemplate event params // so you can do $params["smarty"]->assign("ITEM","Value") $this->callEvent( "ontemplate", array("template"=>$template,"smarty"=>$template->_smarty) ); $template->assignComponents(); $template->dumpTemplate(); } } Código:
function dumpHeaderJavascript($return_contents=false) { global $output_enabled; if ($output_enabled) { ob_start(); $this->dumpChildrenJavascript(); $js=ob_get_contents(); ob_end_clean(); $sp=''; if (trim($js)!="" || trim($ajax_js)!="") { $sp="<script type=\"text/javascript\">\n"; $sp.="<!--\n"; $sp.=$js; $sp.="-->\n"; $sp.="</script>\n"; } // ajax js if ($this->_useajax){ global $xajax; $sp=$xajax->getJavascript( "",VCL_HTTP_PATH."/xajax/xajax_js/xajax.js" ).$sp; } if ($return_contents) { return($sp); } else { echo $sp; } } } Código:
function processAjax(){ // do ajax stuff, this was after: // if ($this->_ismaster) return; // in dumpContents, you could replace the code // there for // $this->processAjax(); if ($this->_useajax) { if (($this->ControlState & csDesigning) != csDesigning) { use_unit("xajax/xajax.inc.php"); //AJAX support global $xajax; // Instantiate the xajax object. No parameters defaults //requestURI to this page, method to POST, and debug to // off $xajax = new xajax(); // Uncomment next line to turn debugging on // $xajax->debugOn(); // Specify the PHP functions to wrap. The JavaScript //wrappers will be named xajax_functionname $xajax->registerFunction("ajaxProcess"); // Process any requests. Because our requestURI is the // same as our html page, // this must be called before any headers or HTML output // have been sent $xajax->processRequests(); //AJAX support } } } Código:
function assignComponents() { $form=$this->owner; $this->_smarty->assign('HeaderCode', $form->dumpChildrenHeaderCode(true).$form->dumpHeaderJavascript(true)); $this->_smarty->assign('StartForm', $form->readStartForm()); $this->_smarty->assign('EndForm', $form->readEndForm()); reset($form->controls->items); while (list($k,$v)=each($form->controls->items)) { if ($v->Visible) { $temp="<SPAN id='{$v->Name}_outer'>".$v->show(true)."</SPAN>"; $this->_smarty->assign($v->Name, $temp); } } } Saludos. |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Delphi for PHP Template | Rony Díaz | PHP | 2 | 10-07-2007 16:07:39 |
lenguaje ajax | srangel | HTML, Javascript y otros | 2 | 20-04-2007 00:11:57 |
Java y Ajax | Alejo | JAVA | 1 | 19-02-2007 17:23:48 |
Google-Ajax | vtdeleon | Noticias | 1 | 18-05-2006 13:10:58 |
Como hacer uso de asp en un template de intraweb? | JoelCarlos | Internet | 0 | 01-09-2005 18:11:46 |
|