[Solved] add a javascript file to the admin section

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
hostep
New Member
New Member
Posts: 9
Joined: Sat Feb 02, 2008 2:06 pm

[Solved] add a javascript file to the admin section

Post by hostep »

Hi there

I'm developing my own module, and it already goes very well.
But now i need some javascript on the admin side of the site.
And I can't find how to make a tag in the head of the admin pages without changing the theme.

Is this possible?
If yes, how?
If not, maybe there is another nice way to embed javascript on the admin side?


Thanks!
Last edited by hostep on Tue May 20, 2008 10:56 pm, edited 1 time in total.
rayman22201

Re: add a javascript file to the admin section

Post by rayman22201 »

I also needed to add some javascript to an admin module and had the same trouble, and couldn't find an easy solution directly.

I ended up kind of cheating by embedding the script into an Iframe, passing any variables I needed from the module as GET variables in the SRC tag of the iframe... It is a really patchwork solution, but it worked in a hurry.
;D
hostep
New Member
New Member
Posts: 9
Joined: Sat Feb 02, 2008 2:06 pm

Re: add a javascript file to the admin section

Post by hostep »

Thanks for the reply, but in the mean while I already found the correct solution.

You just have to put the extra javascript tags in the GetHeaderHTML() function in the module.

That's much cleaner than your patchwork ;)
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: [Solved] add a javascript file to the admin section

Post by calguy1000 »

I usually just embed the javascript into whichever templates I need, then there's no issue.

if I need the javascript in more than one template, I can use smarty's {include} tag.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
rayman22201

Re: add a javascript file to the admin section

Post by rayman22201 »

hostep wrote: Thanks for the reply, but in the mean while I already found the correct solution.

You just have to put the extra javascript tags in the GetHeaderHTML() function in the module.

That's much cleaner than your patchwork ;)
You know....I really need to read the api more closely....Then again I was in a really big hurry when I came up with the iframe solution, but either way, thanks, now I know how to do it the right way  ;D
Post Reply

Return to “Modules/Add-Ons”