called a file with ajax

Author Message

Alain Mangana

Friday 24 October 2008 2:25:28 am


I want to call a livre.tpl in a template from a ajax


  {literal}
								
    <script type='text/javascript'>

         function go(){
		var xhr = getXhr();
		xhr.onreadystatechange = function(){
	                     if(xhr.readyState == 4 && xhr.status == 200){
				leselect = xhr.responseText;
				document.getElementById('book').innerHTML = leselect;
			      }
		}
	{/literal}
		var perm =   "{concat($current_user.role_id_list|implode(','),'|',$current_user.limited_assignment_value_list|implode(','))|md5}";
		var lien = "{"content/livre"|ezurl(no)}?&perm=" + perm;
	{literal}
		xhr.open("GET",lien ,true);
		xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		sel = document.getElementById('auteur');
		idauteur = sel.options[sel.selectedIndex].value;
		xhr.send("idAuteur="+idauteur);
           }

       </script>

    {/literal}

in return I want to have nothing but the contents of the file without the structure of the page pagelayout.
who can help me

http://tikdem.com
/

Yannick Komotir

Friday 24 October 2008 2:58:40 am

see this post http://ez.no/developer/forum/developer/problem_with_ajax_and_ez_publish

<|- Software Engineer @ eZ Publish developpers -|>
@ http://twitter.com/yannixk

John Moritz

Friday 24 October 2008 10:46:59 am

Do you realy want to call the .tpl file directly, or do you want to get the output from the php file of your template/module?

You can replace the Template output like $tpl->fetch("design:module/your-template.tpl"); with:
eZExecution::cleanExit();
Just replace it....done
This means that you get the clean output of the php script of your module.

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 31 2025 00:34:52
Script start
Timing: Jan 31 2025 00:34:52
Module start 'layout'
Timing: Jan 31 2025 00:34:52
Module start 'content'
Timing: Jan 31 2025 00:34:52
Module end 'content'
Timing: Jan 31 2025 00:34:52
Script end

Main resources:

Total runtime0.0245 sec
Peak memory usage8,192.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 588.1250151.2109
Module start 'layout' 0.00460.0040 739.3359220.6875
Module start 'content' 0.00860.0144 960.0234997.8984
Module end 'content' 0.02300.0014 1,957.921933.9922
Script end 0.0245  1,991.9141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002811.2555140.0002
Check MTime0.00114.4755140.0001
Mysql Total
Database connection0.00052.221710.0005
Mysqli_queries0.00218.664830.0007
Looping result0.00000.037010.0000
Template Total0.00104.110.0010
Template load0.00083.274110.0008
Template processing0.00020.845110.0002
Override
Cache load0.00052.225610.0005
General
dbfile0.00228.885880.0003
String conversion0.00000.025340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs