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.

Javascript embed...

March 18, 2011 9:19am

Subscribe [3]
  • #1 / Mar 18, 2011 9:19am

    Dear all,

    For some reason I am having problems using a Javascript File created and embedded within EE.

    The Javascript file has been created and works fine externally when added but not when I try internally. Any help appreciated.

    I have managed to link a stylesheet fine like so, but how would I do this for JS.

    <link rel=‘stylesheet’ type=‘text/css’ media=‘all’ href=’{stylesheet=Includes/stylesheet}’ />

    Probably the most simple of changes… :o)

  • #2 / Mar 23, 2011 11:04am

    ralph.m

    225 posts

    You can just link to the JS template like so:

    <sc*ipt type=“text/javascript” src=”{path=scripts/myscript}”></sc*ipt> 

    (assuming you have a template group called “scripts’ in which there’s a template called “myscript”).

    Or you can just place the scripts in a folder on your server and link normally:

    <sc*ipt type=“text/javascript” src=”/scripts/myscript.js”></sc*ipt>

    I normally do the latter, and if the link is to appear on more than one page, I place it in a global variable and just paste that on each page.

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

ExpressionEngine News!

#eecms, #events, #releases