News:

SMF 2.0.19 has been released! Please update. Read more.

Main Menu

Including scripts in the head of a page

Started by BradT, August 28, 2012, 12:24:15 AM

Previous topic - Next topic

BradT

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

mrintech

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

BradT

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.

Advertisement: