[support] $script empty for anonymous users
luca capra
luca.capra at gmail.com
Mon Mar 30 12:04:44 UTC 2009
hi,
try path_to_theme() to get the path to current theme
drupal_add_js( path_to_theme() ."/js/onebip.js");
try either creating a module with something like
function mymodule_init(){
$theme = variable_get('theme_default', 'garland');
$theme_path = drupal_get_path("theme", $theme);
|| drupal_add_js("$theme_path/js/onebip.js");
}
to use in more than one theme.
Luca
Davide Michel 'ZioBudda' Morelli ha scritto:
> Hi all, this is the first time that I see this thing: in my theme I
> have these lines:
>
> <?php echo $scripts; ?>
> <script type="text/javascript" src="<?php echo $directory;
> ?>/js/onebip.js"></script>
>
> All works for loggedin users, but $scripts is empty for the anonymous
> users. Why this ? Why $scripts is empty for anonymous users ?
>
> Now, to resolve this problem I have delete the line
>
> <script type="text/javascript" src="<?php echo $directory;
> ?>/js/onebip.js"></script>
>
> from my page.tpl.php file, and I have create a template.php file with
> this code:
>
> <?php
> drupal_add_js("sites/all/themes/onebipv1/js/onebip.js");
> ?php>
>
> and now all works. But why this ? If this is correct: how can I
> retrieve the values of my themes directory ($directory in the
> page.tpl.file) ?
>
> Tnx.
>
More information about the support
mailing list