ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to link to js templates

December 20, 2011 1:04pm

Subscribe [3]
  • #1 / Dec 20, 2011 1:04pm

    Kaspar

    30 posts

    Hi

    I’m a bit confused there seems to be no information on how to link to javascript templates.

    First I though just using the same syntax like linking to css files

    < script type="text/javascript" href="{javascript='javascript/app'}"></ script>

    Then I tried this:

    < script src="{path="javascript/app"}"  type="text/javascript"></ script>

    Doesn’t work.

    Then I tried this:

    < script src="{path="{site_url}/system/expressionengine/templates/default_site/javascript/foundation.js"}" type="text/javascript"></ script>

    But that doesn’t work either.

    I can’t manage to find anything on google or the forum search or the Wiki.
    Does everybody place their JS files outside EE?

    Thanks for any help

    (Edit)

    Oh man. Now it works with

    < script src="{path="javascript/app"}"  type="text/javascript"></ script>

    I don’t know why it works now. But it does. Of course just after I wrote this thread. Murphis law I guess.

  • #2 / Dec 20, 2011 4:42pm

    Rob Allen

    3118 posts

    You can always upload your JS files manually, good practice suggests using a location such as /assets/js - then you can just link using a standard path such as…

    < script src="/assets/js/javascript.js">< / script >
  • #3 / Dec 21, 2011 6:56am

    Kaspar

    30 posts

    Yeah. Next time. I’ll do so. Thank you

  • #4 / Dec 28, 2011 11:48am

    Did you remember to set the template type to Javascript? Just thinking of what I’ve forgotten in the past.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases