[themes] How to include and use jquery plugin in my theme
Sergei Stryukov
sergey at seoecom.com
Sun Aug 24 19:04:04 UTC 2008
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
More information about the themes
mailing list