Forums / Setup & design / Loading Template via Ajax

Loading Template via Ajax

Author Message

Mohammad Tufail

Thursday 12 June 2008 11:33:12 pm

Hi,

I want to implement Ajax in my website but does not know how. Actually I am designing a part of my website same as http://www.profoss.eu/events

Anyone have idea?

Regards,

 

Laurent BOURREL

Thursday 12 June 2008 11:44:40 pm

Hi,

The most simple (but not the only way) is the xajax extension : http://ez.no/developer/contribs/applications/xajax

The API can be found : http://www.xajaxproject.org/

Here an exemple of xajax module with a template fetch :

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;
}

HTH...