Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > PHP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #7  
Antiguo 19-12-2007
jsm jsm is offline
Registrado
 
Registrado: jun 2007
Posts: 1
Poder: 0
jsm Va por buen camino
Smile 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;
}
}
}
y añadir esta otra:

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
}
}
}
Después, en el archivo vcl\smartytemplate.inc.php, sustituir la función assignComponents() por esta:

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);
}
}
}
Por supuesto, antes de modificar nada, haced copia de seguridad de ambos ficheros.

Saludos.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

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


La franja horaria es GMT +2. Ahora son las 13:07:41.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi