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 JS files in header

August 22, 2011 11:51pm

Subscribe [3]
  • #1 / Aug 22, 2011 11:51pm

    EnergyFreak

    102 posts

    Hey guys,

    I did a quick search on the forums on how to link javascript files in the header, but most are outdated and others don’t really answer this question.

    I found this in the documentation, but I do not understand any of it:

    http://ellislab.com/expressionengine/user-guide/modules/jquery/jquery_tags.html

    Can someone give me an example of how to link javascript in header?

    Thanks.

  • #2 / Aug 23, 2011 5:54am

    Fusion Design

    128 posts

    Hi there,

    The jquery tags in the documentation are for embedding EE’s built in jquery.
    For embedding your own scripts, you’ll just need to insert a script tag into your site’s header.
    For ease, I setup a snippet called {script} so I can quickly call in my scripts folder url.

    {site_url}scripts/

    I can then call in a script like so:

    < script type="text/javascript" src="{script}jquery.plugin.min.js">< /script>

    I hope that helps, let me know if you have further questions.

  • #3 / Aug 23, 2011 10:35am

    EnergyFreak

    102 posts

    Hi Fusion,

    I do not understand how to create a snippet, I clicked on snippet in the admin panel, but it asks for the snippet syntax. What must I add in this snippet for JS calling just like your example above?

    Note: I was not able to install the Agile theme for some reason, is there a way I can still import it after installing EE? I would of loved to see some template examples.

    Thanks.

  • #4 / Aug 23, 2011 10:48am

    Fusion Design

    128 posts

    You don’t need to create a snippet, it’s just a helping hand with the urls.

    If you look at my first image, you’ll see what I have for a snippet.
    My second image shows an example of what your header template may look like.

    I hope this makes things clearer.

  • #5 / Aug 23, 2011 10:55am

    Sue Crocker

    26054 posts

    Hi, EnergyFreak. You won’t be able to install the Agile theme unless you choose to re-install EE, which will overwrite your database changes.

    You could choose to do a local install using MAMP or WAMP, and install the Agile theme then.

    Thanks for the assist, Fusion.

    When it comes to working with adding .js files, you can add them the same way you do external .css files. You just need to make sure you path from the root. There is more than one way of doing things. I tend to create a folder on my site off of the root called /jscss - and store all my .css and .js files there.

    Does that help?

  • #6 / Aug 23, 2011 12:25pm

    EnergyFreak

    102 posts

    Hi guys,

    Thanks a lot for the detailed explanations and the screenshots, you are a lot of help!

  • #7 / Aug 23, 2011 12:53pm

    Sue Crocker

    26054 posts

    That’s what we’re here for.. let us know if we can assist further.

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

ExpressionEngine News!

#eecms, #events, #releases