$script empty for anonymous users
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. -- Michel 'ZioBudda' Morelli michel@ziobudda.net Consulenza sistemistica in ambito OpenSource. Sviluppo applicazioni web dinamiche (LAMP+Ajax) Telefono: 0200619074 Telefono Cell: +39-3939890025 -- Fax: +39-0291390660 http://www.ziobudda.net ICQ: 58351764 http://www.ziobuddalabs.it Skype: zio_budda http://www.ziodrupal.net MSN: michel@ziobuddalabs.it JABBER: michel@ziobuddalabs.it
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.
participants (2)
-
Davide Michel 'ZioBudda' Morelli -
luca capra