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...template type...link or embed

November 15, 2010 6:48pm

Subscribe [4]
  • #1 / Nov 15, 2010 6:48pm

    municipal

    165 posts

    I have various jquery snippets that I want ready access to so I have them in one template within EE. (These are separate and apart from full-fledged js which are not contained within EE.)

    I don’t want accesses to count as template hits. Do I…

    —create a template consisting of everything from opening script tag to closing script tag and then embed it using the syntax {embed="myjs/somescripting"} OR

    —create a template consisting of just the meaty part and then link to it using the syntax [script type=“text/javascript” src=”{path="myjs/somescripting"}”][/script]

    And when does one set the template type to Javascript?

  • #2 / Nov 16, 2010 8:48am

    Sue Crocker

    26054 posts

    To tell you the truth, I rarely keep css and js files inside of EE, I normally keep them as stand alone files on the server.

    If it’s the template count that worries you, you can always write a cron job to zero out the template hits.

    Here’s what I found when searching on the topic: http://ellislab.com/forums/viewthread/144935/#712074

    Does that advice help?

  • #3 / Nov 16, 2010 3:56pm

    municipal

    165 posts

    Can you explain what the purpose is of setting the template type to Javascript? And when to utilize it?

  • #4 / Nov 17, 2010 3:25am

    John Henry Donovan

    12339 posts

    municipal,

    You set your template to Javascript when you want to return it as a Javascript page with a Content-Type: text/javascript

    You would not include the opening script tag to closing script tag

    I don’t want accesses to count as template hits

    Easiest is then to just not include your Javascript as an EE template but as a stand alone files on the server as Sue does.

  • #5 / Nov 17, 2010 7:04am

    municipal

    165 posts

    Okay, thanks for the assist.

  • #6 / Nov 17, 2010 4:52pm

    Ingmar

    29245 posts

    Glad to see that helped. Post again as needed, please.

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

ExpressionEngine News!

#eecms, #events, #releases