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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 16:25:37
Script start
Timing: Jan 18 2025 16:25:37
Module start 'layout'
Timing: Jan 18 2025 16:25:37
Module start 'content'
Timing: Jan 18 2025 16:25:38
Module end 'content'
Timing: Jan 18 2025 16:25:38
Script end

Main resources:

Total runtime0.8426 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 587.9141152.6250
Module start 'layout' 0.00710.0031 740.539139.4453
Module start 'content' 0.01030.8309 779.9844492.3750
Module end 'content' 0.84120.0014 1,272.35948.3203
Script end 0.8426  1,280.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4062160.0002
Check MTime0.00140.1643160.0001
Mysql Total
Database connection0.00070.086010.0007
Mysqli_queries0.798094.7071540.0148
Looping result0.00050.0605520.0000
Template Total0.811296.320.4056
Template load0.00220.261020.0011
Template processing0.809096.001320.4045
Template load and register function0.00010.011310.0001
states
state_id_array0.00090.108010.0009
state_identifier_array0.00140.160720.0007
Override
Cache load0.00180.2132160.0001
Sytem overhead
Fetch class attribute can translate value0.00060.073220.0003
Fetch class attribute name0.00140.164830.0005
XML
Image XML parsing0.00070.078520.0003
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00080.0941160.0000
String conversion0.00000.001240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs