By sodani on
Hi, per this handbook page - http://drupal.org/node/52389 - I'd like to add a separate admin theme and front page. I'm able to do them separately, but I don't know how to get them both working simultaneously. I know that I just need to combine the 2 snippets, but I don't know how to do that. Can someone please tell me how?
The 2 snippets are...
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'page':
if ((arg(0) == 'admin')) {
$vars['template_file'] = 'page-admin';
}
break;
}
return $vars;
}
and
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'page':
global $user;
if ($vars['is_front']) {
$vars['template_file'] = 'page-index';
}
break;
}
return $vars;
}
Comments
This should work
It seems like you are not checking if the user is the admin?? You are only checking if the user is in the admin area. If you want the theme to be applied when the user is the admin, modify it so that it is checking if $user == 'admin'
----
http://LandCondos.com
awesome!
that works great! I'm not sure why the
global $useris needed. I just lifted it from the handbook page above.Not sure, either
I am not sure why they did that. It doesn't seem like the variable is referenced at all. Maybe you can try masking it out to see if the code still works.
kompressor - in this vain,
kompressor - in this vain, would you be able to tell me how to implement a whole new page-type.tpl.php file for a page that's not an admin or index page?
Without knowing too much
Without knowing too much about your situation, you can basically start with any .tpl.php page and add your styling to it. After that, you just add some code(like above) to make it visible for that page or node.
Theming and Customization page:
http://drupal.org/node/45471
----
http://LandCondos.com