inserting javascript

Grizz - April 25, 2007 - 01:10

Hi all,

This has probably been addressed somewhere in the 100's of page I found doing a search, after reading 18 pages of post, I decided to just post it here.

How do I insert a javascript into a block? (and pass validation)

If I used php scripts instead, is there a specific way to add them to a block? (for future reference)

Or, should I create an empty block, use my editor to strip out the code of the block in the html, and add the block to the page.tpl(s) code. I'd rather not do it this way because some scripts are used on some pages, other scripts on other pages, meaning a whole lot of page.tpl's to manage on a large site.

THX in advance,
Grizz

=-=

VM - April 25, 2007 - 02:33

to use javascript you would use the drupal_get_js() function ?

see: http://api.drupal.org/api/5/function/drupal_get_js

Thank You VeryMisunderstood

Grizz - April 25, 2007 - 03:12

Thank You VeryMisunderstood for the link.

Now all I need to do is figure out how to use certain scripts on specific pages without using a lot of page.tpl's. So I'm off to do some trial and error.

Grizz

Nitin how can i pass the

nitin_singh - September 21, 2007 - 11:02

Nitin
how can i pass the javascript code to drupal_get_js?

does it compress the js files like other js compression tools?

 
 

Drupal is a registered trademark of Dries Buytaert.