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

Farsheed tfarsheed at yahoo.com
Sun Aug 24 18:09:30 UTC 2008


> From: Sergei Stryukov <sergey at seoecom.com>
> Subject: Re: [themes] How to include and use jquery plugin in my theme
> To: "A list for theme developers" <themes at drupal.org>
> Date: Sunday, August 24, 2008, 10:28 AM
> Hello Konstantin,
> 
> You can include this script in page.tpl.php:
> 
> <script type="text/javascript"
> src="path-tp-theme/scripts/jquery.corner.js"></script>
> 
> Add this code before </head> tag.


That doesn't guarantee that jquery.js is loaded. If you do 

drupal_add_js(path_to_theme() . '/js/jquery.corner.js');

in your template file than you can be sure that both jquery.js and jquery.corner.js are automatically loaded. 




 
> Sunday, August 24, 2008, 4:28:15 PM, you wrote:
> 
> > Hi,
> 
> > page.tpl.php is too late because the scripts are
> already generated  
> > (and available in $scripts) in that template. You
> should add it in  
> > either a module or a preprocess function in
> template.php.
> 
> > Konstantin
> 
> 
> > On 21.08.2008, at 01: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
> 
> > _______________________________________________
> > themes mailing list
> > themes at drupal.org
> > http://lists.drupal.org/mailman/listinfo/themes
> 
> 
> 
> -- 
> Best regards,
>  Sergei                           
> mailto:sergey at seoecom.com
> 
> _______________________________________________
> themes mailing list
> themes at drupal.org
> http://lists.drupal.org/mailman/listinfo/themes


      


More information about the themes mailing list