I hope I'm asking the right question. I'm attempting to incorporate a Trumba calendar via one of their "spuds". It appears what's holding me back is the ability to add a javascript into the HTML head. I see the list of javascripts in the rendered page, but can't figure out where to add another. Is it possible? Or am I asking the wrong question?

Comments

vm’s picture

http://api.drupal.org/api/function/drupal_add_js/6 woud be the method drupal uses to embed js in head.

There are quite a few threads floating around the forum that will explain this in further detail which may help clarify the linked page from api.drupal.org

tawebworks’s picture

THANKS!!

gforce301’s picture

Sure it's not only possible but it's pretty easy.
The function you are looking for is drupal_add_js please read about it here --> http://api.drupal.org/api/function/drupal_add_js/6

EDIT:
My apologies. I must have opened a comment form and wandered off for a while, not realizing that this post had been answered with the exact same answer I was going to give. Sorry to add meaningless comments.

G

tawebworks’s picture

I see the explanation and all this great code... but (since I'm not a developer), I don't know where/how to use it.
Do I put my new javascript on line 1960 of includes/common.inc? Or do something else?

gforce301’s picture

Changing core files like common.inc is bad ju ju :)

Let me ask you a question so that I can help you better.
Are you coding a module to do this 'integration' or just making a node to do it?

tawebworks’s picture

I'm looking for the easiest way to place a box with the Trumba calendar in it on my home page (sidebar first). I want the dates clickable, such that clicking an active date brings up event details in the content section.

I'm all ears to your wisdom and experience.

gforce301’s picture

To make a 'box' (drupal calls them 'blocks') for your sidebar you create a block. If you set the imput format to php for the block, you can use the drupal_add_js function to include the javasrcript you need whenever the block is displayed. Don't forget to include the php open and close tags.

As for the second part, since I don't know anything about Trumba I can't really advise you on how to make that work without more information.

tawebworks’s picture

Thanks... I've built the block, but will implement your notes and ask more if I need to.

tawebworks’s picture

The only options I see available to me are filtered or full HTML.

gforce301’s picture

You might have to enable the php filter first to make it available.

vm’s picture

in case that isn't clear, by enabling the php filter the user means turning on the php filter.module in administer -> modules. you will than have acces to the php input format

mm167’s picture

if u are newbie of drupal, why not tell us what u really want to do? Tell us the final result u want, dont just ask how to add a "box"?

tawebworks’s picture

My client has a Trumba account with a very effective calendar + registration options. I'm not looking to recreate this for them. Rather, I want to incorporate their Trumba calendar on their home page. Trumba offers "spuds" to embed their calendar. However, the spud requires certain javascript be added to the HTML header tag.

Is there a better way to do what I'm attempting?