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

Brent Hardinge design at bibleinfo.com
Sun Aug 24 19:10:19 UTC 2008


Sergei,

Your second post is correct in that it will always point to the  
current theme but your original post implies a hard coded link, as it  
makes not mention of the php snip.

Cheers,
Brent

On Aug 24, 2008, at 12:04 PM, Sergei Stryukov wrote:

> Hello Larry,
>
> Sunday, August 24, 2008, 9:05:34 PM, you wrote:
>
>> On Sunday 24 August 2008 9:28:25 am Sergei Stryukov wrote:
>>> 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.
>
>> No, don't do that.  That skips all of Drupal's JS handling and  
>> compression and
>> caching mechanisms, and is totally not portable across different  
>> sites.  Hard
>> coded paths are never correct.
>
> <script type="text/javascript" src="<?php echo path_to_theme(); ?>/ 
> scripts/jquery.corner.js"></script>
>
> Do you mean that this hard coded path is not correct? I don't think
> so.
>
> Yes, maybe drupal_add_js is better, but this hard coded path is
> correct.
>
>
>> If you're on Drupal 5, then call drupal_add_js from a module or at  
>> the top of
>> your template.php file.
>
>> If you're on Drpual 6, it's even easier.  Simply add the following  
>> line to
>> your theme's .info file:
>
>> scripts[] = jquery.corner.js
>
>> And then visit the themes admin page to refresh the info cache.   
>> Drupal will
>> handle it from there.
>
>
>
>
> -- 
> 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