Es una clase para crear facilmente un menu horizontal como este:
Código PHP:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
Uso:
$this->main_menu->add('cpanel/admin','Admin');
$this->main_menu->add('cpanel/advertiser','Anunciante');
$this->main_menu->add('cpanel/blogger','Blogger',true);
echo $this->main_menu->generate();
*/
Class Main_menu {
private $items = array();
public function add ($uri,$anchor,$on=false){
$on = ($on==true) ? 'on' : 'ge';
$this->items[] = "<li class=\"$on\" ><a href=\"$uri\">$anchor</a></li>";
}
public function generate(){
$out = '<div id="tabmenu"><ul><li class="tm_begin"></li>';
foreach ($this->items as $item){
$out .= $item;
}
$out .= '<li class="tm_end"> </li></ul></div>';
return $out;
}
} // end class
Cita:
a, a:visited {
text-decoration: none;
color:#058D16
}
a:hover {
text-decoration: underline;
}
#tabmenu {
width: auto;
overflow:hidden;
padding: 7px 0 4px 0;
margin-bottom: 10px;
height: 28px;
margin-left:-20px;
margin-bottom:20px;
}
#tabmenu ul {
list-style:none;
padding:0 10px 0 20px;
margin:0px;
}
#tabmenu li {
float:left;
text-align:center;
display:block;
padding: 0;
font-size:150%;
}
#tabmenu li a,#tabmenu li a:visited {
display:block;
padding: 4px 15px 6px 15px;
border: #BEBEBE 1px solid;
border-width: 1px 0 0 1px;
}
#tabmenu li.ge a,#tabmenu li.ge a:visited {
background: url("tab_bg.gif") repeat-x;
color: #666;
}
#tabmenu li.ge a:hover {
background: #E6E6E6;
text-decoration: none;
}
#tabmenu li.on {
overflow: hidden;
}
#tabmenu li.on a,#tabmenu li.on a:visited {
font-weight: bold;
text-decoration: none;
background: none;
}
#tabmenu li.on a:hover {
background: none;
}
#tabmenu li.tm_begin {
height: 24px;
width: 10px;
border-bottom: #BEBEBE 1px solid;
}
#tabmenu li.tm_end {
height: 24px;
width: 27px;
border-left: #ccc 1px solid;
border-bottom: #ccc 1px solid;
}
#tabmenu li.tm_register a{
background: #DDDDDD;
}
text-decoration: none;
color:#058D16
}
a:hover {
text-decoration: underline;
}
#tabmenu {
width: auto;
overflow:hidden;
padding: 7px 0 4px 0;
margin-bottom: 10px;
height: 28px;
margin-left:-20px;
margin-bottom:20px;
}
#tabmenu ul {
list-style:none;
padding:0 10px 0 20px;
margin:0px;
}
#tabmenu li {
float:left;
text-align:center;
display:block;
padding: 0;
font-size:150%;
}
#tabmenu li a,#tabmenu li a:visited {
display:block;
padding: 4px 15px 6px 15px;
border: #BEBEBE 1px solid;
border-width: 1px 0 0 1px;
}
#tabmenu li.ge a,#tabmenu li.ge a:visited {
background: url("tab_bg.gif") repeat-x;
color: #666;
}
#tabmenu li.ge a:hover {
background: #E6E6E6;
text-decoration: none;
}
#tabmenu li.on {
overflow: hidden;
}
#tabmenu li.on a,#tabmenu li.on a:visited {
font-weight: bold;
text-decoration: none;
background: none;
}
#tabmenu li.on a:hover {
background: none;
}
#tabmenu li.tm_begin {
height: 24px;
width: 10px;
border-bottom: #BEBEBE 1px solid;
}
#tabmenu li.tm_end {
height: 24px;
width: 27px;
border-left: #ccc 1px solid;
border-bottom: #ccc 1px solid;
}
#tabmenu li.tm_register a{
background: #DDDDDD;
}