Advertisement:

Author Topic: Including scripts in the head of a page  (Read 2711 times)

Offline BradT

  • Newbie
  • *
  • Posts: 6
Including scripts in the head of a page
« on: August 28, 2012, 12:24:15 AM »
What would be the best place to add <script type...> declarations to the head of my documents?

For now I have it done in the index.template.php in the theme, but that seems like a really bad place for it if I change the theme.

Where would be the best place to add these?
I would like to be able to add them separately to only the pages with posts that have attachments, but I'll take for any advice at the moment.

Thanks

Offline mrintech

  • Full Member
  • ***
  • Posts: 413
  • Gender: Male
Re: Including scripts in the head of a page
« Reply #1 on: August 28, 2012, 12:31:02 AM »
Well, the best place to insert scripts like Google Analytics, Advertisement Codes etc. is in the footer

Anyways, you can use this MOD: http://custom.simplemachines.org/mods/index.php?mod=2659 - The mod allows you to add visible and invisible scripts/counters and can also add Meta Name Description to your forum :)



If you change theme, then the scripts position will not change as you are now using a MOD

Offline BradT

  • Newbie
  • *
  • Posts: 6
Re: Including scripts in the head of a page
« Reply #2 on: August 28, 2012, 12:36:34 AM »
Thanks for the reply, but I don't think that will work for what I need.

I'm not trying to do SEO. It's a private forum. I am trying to add script libraries (e.g. jQuery) that will be accessed in the page. I really need these in the header along with the other included js and stylesheet files.