Created
July 5, 2011 09:07
-
-
Save pujie/1064525 to your computer and use it in GitHub Desktop.
menu library for codeigniter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
add this to your config.php | |
*/ | |
$config['css']='css_style.css'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h1{ | |
font-family:Verdana, Arial, Helvetica, sans-serif; | |
font-size:30px; | |
} | |
h2{ | |
background: silver; | |
} | |
p{ | |
font-family:Georgia, "Times New Roman", Times, serif; | |
font-size:12px; | |
} | |
#footer{ | |
font-family:Arial, Helvetica, sans-serif; | |
font-size:10px; | |
} | |
#menutable{ | |
color: gold; | |
border: 1px solid gold; | |
} | |
.menuitem{ | |
display: none; | |
position: absolute; | |
list-style-type:none; | |
margin-top:0px; | |
padding-left:0px; | |
background: blue; | |
color:whitesmoke; | |
width: 100px; | |
} | |
.menuitem li:hover { | |
background: gold; | |
color: blue; | |
} | |
.menuheader :hover .menuitem{ | |
display: block | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*place this in Model folder*/ | |
class General extends CI_Model{ | |
function __construct(){ | |
parent::__construct(); | |
$this->load->helper('url'); | |
$this->load->library('menu/menu_lib'); | |
} | |
function setpage($title){ | |
$menu=new Menu_lib; | |
$tmp=anchor('Help/about','About'); | |
$hdr = new Menu_header; | |
$chd['satu']=''; | |
$prd['index']='Index';$prd['Add']='Add Product'; | |
$clt['index']='Index';$clt['Add']='Add Client'; | |
$abt['index']='Index';$abt['faq']='F.A.Q';$abt['About']='About'; | |
$menu_header['1']=$hdr->accept_param('Home/index','Home',$chd); | |
$menu_header['2']=$hdr->accept_param('Product/index','Product',$prd); | |
$menu_header['3']=$hdr->accept_param('Client/index','Client',$clt); | |
$menu_header['4']=$hdr->accept_param('Help/index','Help',$abt); | |
$data['menu']=$menu->show_menu($menu_header); | |
$data['header']="<div>PHP Menu Header</div>"; | |
$data['footer']="<div>PHP Menu Footer</div>"; | |
$data['standard_css']='<link rel="stylesheet" type="text/css" href=' . $this->config->item('base_url') . '/' . $this->config->item('css') . '>'; | |
$data['title']='<h1>' .$title . '</h1>'; | |
$data['css']=$this->config->item('css'); | |
$data['base']=$this->config->item('base_url'); | |
return $data; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*place this in controller folder*/ | |
class home extends CI_Controller{ | |
function __construct(){ | |
parent::__construct(); | |
$this->load->library('menu_lib'); | |
$this->load->model('general'); | |
} | |
function index(){ | |
$data=$this->general->setpage('Home Index Title'); | |
$this->load->view('home/index',$data); | |
} | |
function test(){ | |
$menu=new Menu_lib; | |
$data['menu']=$menu->show_menu(); | |
$this->load->view('home/test',$data); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo $standard_css; | |
echo $header; | |
echo $menu; | |
echo $title; | |
echo $footer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*place this in controller folder*/ | |
class Product extends CI_Controller{ | |
function __construct(){ | |
parent::__construct(); | |
$this->load->helper('form'); | |
$this->load->library('menu/menu_lib'); | |
$this->load->model('general'); | |
} | |
function index(){ | |
$menu=new Menu_lib; | |
$data=$this->general->setpage('Product Index'); | |
$this->load->view('product/index',$data); | |
} | |
function add(){ | |
$menu=new Menu_lib; | |
$data['menu']=$menu->show_menu(); | |
$this->load->view('product/add',$data); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*place this in your view/home/ folder */ | |
$this->load->view('share/header'); | |
echo $menu;?> | |
<h2>this is a test page</h2> | |
<?php | |
$this->load->view('share/footer'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a php menu library for CodeIgniter framework