It is not working because you are concatenating the string returned from drupal_get_path('theme', 'sanskrit')
with '/sites/all/themes/sanskrit/scripts/jquery-1.4.3.min.js'
; supposing that you didn't install Drupal in a sub-directory of the server root directory, the filename you are passing to drupal_add_js()
is sites/all/themes/sanskrit/bbbsites/all/themes/sanskrit/scripts/jquery-1.4.3.min.js.
The code you should use is the following one.
if ($_SERVER['REQUEST_URI'] == '/node/1') {
$theme_path = drupal_get_path('theme', 'sanskrit');
drupal_add_js($theme_path . '/scripts/jquery-1.4.3.min.js', 'inline');
drupal_add_js($theme_path . '/scripts/jquery.nivo.slider.pack.js');
}
As others pointed out, to check if the user is viewing the front page, you just call drupal_is_front_page().
Paths like sites/all/themes should be never hard coded in a theme/module code, as a theme could be installed in sites/<domain.name>/themes/<theme.name>
, and a module could be installed in sites/<domain.name>/modules/<module.name>
. Suppose that the Drupal installation is used for the domain blog.example.com, the Views module could be installed in sites/blog.example.com/modules/views, and a theme like the Whitebull theme could be installed in sites/blog.example.com/themes/whitebull.