adding eZ template language to a javascript file

Author Message

Rami Grossman

Tuesday 11 May 2004 5:03:33 am

I use the - <script type="text/javascript" src={"bin/file.js"|ezdesign}></script> in my pagelayout.tpl file. how can I add an eZ publishe template language to the file.js?

I know how to solve it if I put the javascript not seperatly but inside the pagelayout.tpl file, but it will work slower. but generaly also in the css file I want to add some eZ code. for example the path of the images - I need it this way - {"file.gif"|ezimage}. but I can't not in the file.js nor in the file.css .

thanks!

Olav Lillebø

Tuesday 11 May 2004 5:57:14 am

Not sure if this helps, but maybe try putting the script in a .tpl-file, and from pagelayout use something like

{include uri="design:script.tpl"}

and then, in the script, turn on and off literal to switch between tpl-language and js-language.

{literal}
<script language="JavaScript1.2"><!--
.....
{/literal}
{* Here put template language *}
{literal}
......
{/literal}

Olav..

Rami Grossman

Tuesday 11 May 2004 6:45:36 am

thanks, but it doesn't help.
eZ team know exactly what I mean. I guess they don't have an answer.

<script type="text/javascript" src={"bin/file.js"|ezdesign}></script>
I need this to work and file.js must have eZ template code. it works a lot faster than when I put the javascript inside the html.

Paul Forsyth

Tuesday 11 May 2004 6:50:48 am

For that you need to modify the ez file resource classes to examine other files than .tpls.

Plus you need to actually create an interpreted file, the reason being your html file will still be referencing the js/css file as a file to be imported, therefore it must exist somewhere in the servers path. eZ only creates the html, the server does the rest.

Its a task i see as happening sometime because it *greatly* increases the power of the tempalte system.

paul

--
http://www.visionwt.com

Rami Grossman

Wednesday 12 May 2004 11:30:18 am

thanks! do you know if eZ are going to implement this feature. I thought it is trivial to work till I tried.

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 01:15:14
Script start
Timing: Jan 31 2025 01:15:14
Module start 'layout'
Timing: Jan 31 2025 01:15:14
Module start 'content'
Timing: Jan 31 2025 01:15:14
Module end 'content'
Timing: Jan 31 2025 01:15:14
Script end

Main resources:

Total runtime0.0315 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0091 588.2734151.2266
Module start 'layout' 0.00910.0043 739.5000220.7188
Module start 'content' 0.01340.0160 960.21881,001.8516
Module end 'content' 0.02940.0020 1,962.070333.9922
Script end 0.0314  1,996.0625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00299.2457140.0002
Check MTime0.00113.4629140.0001
Mysql Total
Database connection0.00154.832310.0015
Mysqli_queries0.00299.202530.0010
Looping result0.00000.066710.0000
Template Total0.00154.610.0015
Template load0.00123.684810.0012
Template processing0.00030.937710.0003
Override
Cache load0.00072.191910.0007
General
dbfile0.00278.556580.0003
String conversion0.00000.021240.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