Hi all,
I'm working on a new relase of my theme for Drupal 6.x and all the blocks have rounded corners.
I want to use this plugin to achieve this.
http://malsup.com/jquery/corner/
I don't know where I must put this script, I don't know how to include this script inside my theme and then after how can I use it.
Someone can help me to achieve this with some links, resources, suggestions?
Thanks
http://api.drupal.org/api/function/drupal_add_js
As soon as you add a JS file with that function, jQuery gets added automatically.
Konstantin
On 20.08.2008, at 14:07, Massimiliano Marini wrote:
Hi all,
I'm working on a new relase of my theme for Drupal 6.x and all the blocks have rounded corners.
I want to use this plugin to achieve this.
http://malsup.com/jquery/corner/
I don't know where I must put this script, I don't know how to include this script inside my theme and then after how can I use it.
Someone can help me to achieve this with some links, resources, suggestions?
Thanks
Massimiliano Marini - http://www.linuxtime.it/massimilianomarini/ "It's easier to invent the future than to predict it." -- Alan Kay _______________________________________________ themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
Hi Konstantin,
http://api.drupal.org/api/function/drupal_add_js
As soon as you add a JS file with that function, jQuery gets added automatically.
Thanks 1k
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?
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@drupal.org http://lists.drupal.org/mailman/listinfo/themes
Hi Nicolas,
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.
It works. Thanks for your great help.
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@drupal.org http://lists.drupal.org/mailman/listinfo/themes
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.
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@drupal.org http://lists.drupal.org/mailman/listinfo/themes
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
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.
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.
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.
On Sunday 24 August 2008 2:04: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.
That's not what you posted above. :-) If you have to reference a file in the template directly, yes, use path_to_theme() to avoid hard coding the path. However, as Farsheed pointed out even that is insufficient because it won't trip Drupal's JS routines and you therefore may not have jQuery itself available to you. That makes the jQuery plugin rather useless. :-)
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@seoecom.com
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
Hello Brent,
Yes, my bug. Sorry :)
Sunday, August 24, 2008, 10:10:19 PM, you wrote:
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@seoecom.com
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
From: Sergei Stryukov sergey@seoecom.com Subject: Re: [themes] How to include and use jquery plugin in my theme To: "A list for theme developers" themes@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@drupal.org http://lists.drupal.org/mailman/listinfo/themes
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
-- Best regards, Sergei mailto:sergey@seoecom.com
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes