Share » Forums » Setup & design » Loading Template via Ajax

Loading Template via Ajax

Loading Template via Ajax

Thursday 12 June 2008 11:33:12 pm - 1 reply

Author Message

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...

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu