Forums / Setup & design / How to ez-ajax my site

How to ez-ajax my site

Author Message

Jorge estévez

Thursday 19 June 2008 8:49:44 am

Hello!

As far as I have read [ maybe not enough at all :-) ], to make my site work with ajax ( my site is ez v3.10 ) I have to install a basic extension first: xajax an then install ezxajax... ( at least this a solution I found hoping it works out )

What I have not found yet is where ot put the PHP code within Ez files ( not the extensions, read further ) and then access the code from an Ez publish template (.tpl) or any other link elsewhere.

I found the following code at the forum:

function xxxx($object_id) {

	// HTTP Response
	$objResponse = new xajaxResponse();
	
	// template init
	$tpl =& templateInit();
	
	// Add Variable to the template
	$tpl->setVariable('object_id', $object_id);

	// fetch template
	$html = $tpl->fetch(
"extension/mod_myextension/design/standard/templates/foo/bar.tpl" );

	$objResponse->addAssign("mydiv", "innerHTML", $html);
	
	// response
	return $objResponse;
}

So two issues here that I need to solve:

Where does this code can be placed.
How to invoke the function from an Ez publish template or any other link elsewhere.

thanks!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Patrick Renaud

Tuesday 22 July 2008 8:51:02 am

Hello there !

I have the same kind of problem with almost exactly the same code as Jorge.
Using the xajax hello world contribution as a start, I'm trying to fetch and return some dummy template with ajax.
The problem is, when I put a templateInit instruction in my ajax code, it never returns...

Does anybody have a hint as to what to do to make it work ?

Ca, c'est fait !

Patrick Renaud

Tuesday 22 July 2008 9:09:37 am

A first answer : http://ez.no/developer/forum/developer/ajax_to_return_an_ez_publish_template_eg_new_comment

Ca, c'est fait !