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,

Comments

nijuley’s picture

Look at this http://drupal.org/node/52389
and http://drupal.org/node/46006 then you will get an idea.

function _phptemplate_variables($hook, $vars = array()) {
  switch ($hook) {
    case 'page':
      if ((arg(0) == 'admin')) {
        $vars['template_file'] = 'page-admin';
      }
      break;
  }

  return $vars;
}
onejam’s picture

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

-----------------------------------------------------------------
We build engaging websites and intuitive designs that will benefit your business.
Duvien

dvessel’s picture

"page-admin.tpl.php" is already suggested by core. No need to add extra code for it.

joon park
–the devil in the details–

onejam’s picture

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

-----------------------------------------------------------------
We build engaging websites and intuitive designs that will benefit your business.
Duvien