Club Delphi  
    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

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 10-07-2007
Rony Díaz Rony Díaz is offline
Registrado
 
Registrado: jul 2007
Posts: 4
Poder: 0
Rony Díaz Va por buen camino
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...
Responder Con Cita
  #2  
Antiguo 14-08-2007
lalombardi lalombardi is offline
Registrado
 
Registrado: ago 2007
Posts: 3
Poder: 0
lalombardi Va por buen camino
Template & Ajax

Hola Rony,

Tengo el mismo problema y estoy buscando la solucion.
Ni bien la encuentre te paso el dato

Saludos, Luis
Responder Con Cita
  #3  
Antiguo 14-08-2007
Avatar de Ñuño Martínez
Ñuño Martínez Ñuño Martínez is offline
Moderador
 
Registrado: jul 2006
Ubicación: Ciudad Catedral, Españistán
Posts: 6.000
Poder: 25
Ñuño Martínez Tiene un aura espectacularÑuño Martínez Tiene un aura espectacular
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...
__________________
Proyectos actuales --> Allegro 5 Pascal ¡y Delphi!|MinGRo Game Engine
Responder Con Cita
  #4  
Antiguo 15-08-2007
lalombardi lalombardi is offline
Registrado
 
Registrado: ago 2007
Posts: 3
Poder: 0
lalombardi Va por buen camino
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
Responder Con Cita
  #5  
Antiguo 16-08-2007
Avatar de Ñuño Martínez
Ñuño Martínez Ñuño Martínez is offline
Moderador
 
Registrado: jul 2006
Ubicación: Ciudad Catedral, Españistán
Posts: 6.000
Poder: 25
Ñuño Martínez Tiene un aura espectacularÑuño Martínez Tiene un aura espectacular
Ya pero, ¿qué no funciona? ¿No carga la página? ¿Muestra algún error? ¿Se queda bloqueado?
__________________
Proyectos actuales --> Allegro 5 Pascal ¡y Delphi!|MinGRo Game Engine
Responder Con Cita
  #6  
Antiguo 16-08-2007
lalombardi lalombardi is offline
Registrado
 
Registrado: ago 2007
Posts: 3
Poder: 0
lalombardi Va por buen camino
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
Responder Con Cita
  #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
Respuesta



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 23:15:14.


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