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.