By harper1983 on
After using the following code:
<?php
function _phptemplate_variables($hook, $vars = array()) {
if($hook == 'page') {
yourthemename_removetab('address book', $vars);
// add additional lines here to remove other tabs
}
return $vars;
}
function yourthemename_removetab($label, &$vars) {
$tabs = explode("\n", $vars['tabs']);
$vars['tabs'] = '';
foreach($tabs as $tab) {
if(strpos($tab, '>' . $label . '<') === FALSE) {
$vars['tabs'] .= $tab . "\n";
}
}
}
?>I am looking for a better way to remove all tabs from my template. After a couple hours of searching, I haven't seen anyone address removing all tabs. How do I do this without a lot of damage?
Comments
For the record...
Why DO you want to remove the tabs? They are a pretty important part of Drupal.
If you simply want to remove the 'tab' look, do that with CSS.
Add this line to css
its simple add this code to your style.css
.tabs{
display:none;
}
but i wonder why you want to turn off tabs? by turning off tabs, you will be missing the ease of admin role in editing contents etc.... If you want to turn off tabs only to specific user roles, such as no tabs for anonymous users or tabs only for admin user, then you need to insert php code into your page.tpl.php
You are both right! The more
You are both right!
The more I think about this, the less I want to do it. I am not particularly happy with the way tabs are displayed, and I will probably correct that with CSS.
Tabs only for Admin.
if ($tabs) : print '
'; endif;
Do you know how i would say
if $user=="admin" then tabs else no tabs
thanks