Forums / Developer / external javascript file fails to execute eZ-code

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/