It's All About Me

make them benefit

How to embed javascript file in expression engine template

with 2 comments

Expression Engine has great features to define various type of templates with rendering proper header information. You can define javascript type template as well. But should we do that? If not, why?

Actually i personaly don’t like to create javascript type template instead i prefer to put the javascript file directly to any folder and include them like below

 <script type="text/javascript" src="{site_url}js/mootools1.2.js"></script>

It’s better than javascript type template because templating need extra time to be parse but if you need to put any dynamic content from any weblog, or gallery or anything else, then you may have to put javascript content to EE template.

Written by kodegeek

June 23, 2009 at 3:44 am

2 Responses

Subscribe to comments with RSS.

  1. You don’t necessarily need to use {site_url} as long as you path from the root.. using /js/jswhatever.js.

    NOTE: ExpressionEngine, not Expression Engine. :)

    I also prefer to keep css files outside of EE, but that’s a personal preference.

    Sue Crocker

    June 23, 2009 at 10:44 am


Leave a Reply