external javascript file fails to execute eZ-code

Author Message

Richard Stronkman

Thursday 24 February 2005 2:14:42 pm

When I place the following code in my template file, it works fine:

<script>
var test = "{'test.jpg'|ezimage(no)}";
document.write("test:" + test);
</script>

It outputs:
<b>design/mysite/images/test.jpg</b>

But when I place the code (between the script tags) in an external js-file and include the javascript file in my template, the output is:

<b>"{'test.jpg'|ezimage(no)}"</b>

I have tried several alternatives:
- single quotes, double quotes, no quotes

But whatever I tried, the url of my image file was not returned.

Can you help me pleaze!

Best regards

Richard Stronkman

Eirik Alfstad Johansen

Thursday 24 February 2005 11:11:43 pm

Hi Richard,

My guess is that, if you want the template code in your js file to be processed, you need to put the code in a separate tpl file instead, and include it the normal way you would an external tmpl file.

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

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 19:07:37
Script start
Timing: Jan 18 2025 19:07:37
Module start 'layout'
Timing: Jan 18 2025 19:07:37
Module start 'content'
Timing: Jan 18 2025 19:07:38
Module end 'content'
Timing: Jan 18 2025 19:07:38
Script end

Main resources:

Total runtime0.8337 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.0066 589.1797152.6406
Module start 'layout' 0.00660.0026 741.820339.4922
Module start 'content' 0.00920.8231 781.3125523.6563
Module end 'content' 0.83230.0014 1,304.96888.1250
Script end 0.8337  1,313.0938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4067160.0002
Check MTime0.00150.1845160.0001
Mysql Total
Database connection0.00150.180310.0015
Mysqli_queries0.781593.7426540.0145
Looping result0.00060.0766520.0000
Template Total0.796995.620.3985
Template load0.00210.253220.0011
Template processing0.794895.336320.3974
Template load and register function0.00020.025310.0002
states
state_id_array0.00180.210310.0018
state_identifier_array0.00110.137520.0006
Override
Cache load0.00170.2062220.0001
Sytem overhead
Fetch class attribute can translate value0.00050.061720.0003
Fetch class attribute name0.00120.144030.0004
XML
Image XML parsing0.00060.075820.0003
class_abstraction
Instantiating content class attribute0.00000.001130.0000
General
dbfile0.00180.2209160.0001
String conversion0.00000.000940.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs