[Grok-dev] Re: More Tutorial Feedback

Martijn Faassen faassen at startifact.com
Sat Jan 5 18:07:55 EST 2008

Noah Gift wrote:
> This is related to the previous email, i.e., ZPT, but the directions on 
> including javascript are a bit vague:
> "Pulling in images or javascript is very similar. Just place your image 
> files and .js files in the static directory, and create the URL to them 
> usingstatic/<filename> in your page template"
> Explicit is better than implicit...
> Does this mean, you need to use the same syntax as for CSS 
> inclusion,i.e.:   <link rel="stylesheet" type="text/css"
>   href="http://localhost:8080/test/@@/sample/style.css" />, or a 
> standard include as in a regular XHTML file.

If you want to include javascript you do something like this:

<script type="text/javascript" tal:attributes="src static/myscript.js" />

The trick is to use tal:attributes so you can dynamically evaluate path 
expressions. Then you use the special 'static' name to go into your 
'static' directory.



More information about the Grok-dev mailing list