Hiding certain code within the page.tpl.php when admin user is login
duvien - March 6, 2008 - 02:40
Hi,
I have a js code that is included in my page.tpl.php script and it works fine but it seems to have conflicts with some of the anchor tags used in the admin section. Therefore, i would like to hide the included js script in the HTML head of the page.tpl.php when logged in as any administrator user. Does anyone know how this can be achieved?
Or is this suppose to be done in the template.php file?
thanks,

Look at this
Look at this http://drupal.org/node/52389
and http://drupal.org/node/46006 then you will get an idea.
<?php
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'page':
if ((arg(0) == 'admin')) {
$vars['template_file'] = 'page-admin';
}
break;
}
return $vars;
}
?>
Thanks for that. I was
Thanks for that. I was aware you can do that but it is only for one page (ie, page-admin.tpl.php). What i wanted was to hide the js script for all pages that the admin is logged into (or each time you are logged in as admin browse any page of the site)?
------------------------------------------
Personal Blog & digital playground: duvien.com
"page-admin.tpl.php" is
"page-admin.tpl.php" is already suggested by core. No need to add extra code for it.
⎋ joon park
–the devil in the details–
Actually, it's okay. I just
Actually, it's okay. I just needed this bit included in template.php:
....else if ((arg(0) == 'node')){
if((arg(1) == 'add') || (arg(2) == 'edit')){
$vars['template_file'] = 'page-admin';
}
}
...
Thanks for the link,
------------------------------------------
Personal Blog & digital playground: duvien.com