[themes] How to include and use jquery plugin in my theme

Nicolas Borda forums at ipwa.net
Thu Aug 21 00:44:08 UTC 2008


in your template php:

drupal_add_js(path_to_theme().'/js/plugin.js', 'theme', 'header');

if you want it for a specific node:

/**
  * Add JavaScript
  */
if ($nid = 14){
       drupal_add_js(path_to_theme().'/js/plugin.js', 'theme',  
'header');
}


you need to add your plugin to a folder named js in your theme folder.

HTH

Nicolas

On 21 Aug 2008, at 00:50, Massimiliano Marini wrote:

>> As soon as you add a JS file with that function, jQuery gets added
>> automatically.
>
> where I must wrote drupal_add_js?
>
> I've tried into my page.tpl.php
>
> example: <?php drupal_add_js('scripts/jquery.corner.js') ?>
>
> but it doesn't work ... why? Where I'm in error?
>
> -- 
> Massimiliano Marini - http://www.linuxtime.it/massimilianomarini/
> "It's easier to invent the future than to predict it." -- Alan Kay
> _______________________________________________
> themes mailing list
> themes at drupal.org
> http://lists.drupal.org/mailman/listinfo/themes

-- 

Nicolas Borda
-------------------------

http://nic.ipwa.net/
http://www.linkedin.com/in/nborda



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/themes/attachments/20080821/af541999/attachment.htm 


More information about the themes mailing list