[support] Theme Function For Adding jQuery

Steve Edwards killshot91 at comcast.net
Mon Dec 22 20:34:26 UTC 2008


I want to create a function in my template.php that will set a different 
banner for certain pages by modifying the background property for the 
div with jQuery.  The jQuery is pretty easy (I would just add it using 
drupal_add_js()), but what I can't figure out is how to call it from 
template.php.  Can I just create my own function in template.php that 
calls drupal_add_js()?  Or do I have to use a hook?  I need to have the 
current URL available to the function.  My first thought was to use a 
preprocess hook, but it seems that the preprocess is for adding 
variables, not this.  If I wanted to write a module I could do something 
like hook_init, but I don't want to have to do a module for something 
small like this if I don't have to.

Thanks

Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20081222/5c21bb6e/attachment.htm 


More information about the support mailing list