[eluser]SPeed_FANat1c[/eluser]
I am doing new project with MY_Controller library, it looks that it should work, but it doesn't.
Ok, MY_Controller:
Code:
class MY_Controller extends Controller{
var $data;
public function __construct(){
parent::__construct();
//default data
$this->data['title'] = 'Ylakių globos namai';
$this->data['meta'] = array(
0 => '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />',
);
$this->data['javascript'] = '';
$this->data['virsutinis_meniu'] = $this->get_top_menu();
$this->data['current_menu'] = 99; //99 reiskia joks meniu nera aktyvus
/*
//sidearui
$this->data['links'] = $this->Views_model->get_links();
$this->data['banners'] = $this->Views_model->get_banners();
*/
/*
//footeriui, jie noresim dinaminiu duomenu
$this->data['footer'] = $this->Views_model->data_for_footer();
*/
}
/*
* paduodam main sekcijos view faila, taip pat kaip ir this load view kai paduodume
*/
function display($main_view){
$this->load->vars($this->data);
//echo 'test';
$this->load->view('header_view');
//echo 'test2';
$this->load->view($main_view);
$this->load->view('sidebar_view');
$this->load->view('footer_view');
}
private function get_top_menu()
{
$this->db->order_by('Eile','asc');
$query = $this->db->get('virsutinis_meniu');
return $query->result_array();
}
}
I try to make simple login function in the controller:
Code:
class Admin extends MY_Controller
{
public function __construct(){
parent::__construct();
$this->load->model('membership_model','membership');
$this->load->helper('form');
}
function index()
{
if($this->membership->is_logged_in())
{
$this->data['title'] = 'Administravimas - pagrindinis meniu';
$this->data['javascript'] = '[removed][removed]
[removed][removed]';
$this->display('admin/main_menu_view');
}
else
{
$this->login();
}
}
function login()
{
$this->data['title'] = 'Administratoiaus prisijungimas';
$this->display('admin/login_view');
}
}
Header file:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html >
<head>
<?php
foreach($meta as $val)
{
echo $val;
}
?>
<link rel="stylesheet" href="<?php echo base_url()?>images/Outdoor.css" type="text/css" />
<title><?php echo $title;?></title>
<s+cript type="text/javascript">
<!--
var CI = {
'base_url': '<?php echo base_url(); ?>'
};
-->
</s+cript>
</head>
<?php
echo $javascript;
?>
<body>
<!-- wrap starts here -->
<div id="wrap">
<!--header -->
<div id="header">
<h1 id="logo-text"><a href="<?php echo base_url()?>" title="">Ylakiu globos namai</a></h1>
<p id="slogan">Seneliu namai</p>
<div id="header-links">
<p>
<a href="index.html">Home</a> |
<a href="index.html">Contact</a> |
<a href="index.html">Site Map</a>
</p>
</div>
<!--header ends-->
</div>
<div id="header-photo"><img src="images/header-photo.jpg" width="870" height="206" alt="header-photo" /></div>
<!-- navigation starts-->
<div id="nav">
<ul>
<?php
$i = 0;
foreach($virsutinis_meniu as $key => $val)
{
if($i == $current_menu)
echo '<li id="current"><a href="'.base_url().$val['Nuoroda'].'">'.$val['Pavadinimas'].'</a></li>';
else echo '<li><a href="'.base_url().$val['Nuoroda'].'">'.$val['Pavadinimas'].'</a></li>';
$i++;
}
?>
</ul>
<!-- navigation ends-->
</div>
<!-- content-wrap starts -->
<div id="content-wrap">
I will not post other view files, because I think we don't need them, because I am not even seeing the header file.
When I go to
http://localhost/ubagynas/admin/login (my site is in folder 'ubagynas')
I see no errors or anything - only white page. When I check the source code in browser, here is what I see:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Have you an idea why there is nothing after metadata? I guess I made some stupid mistake but cannot find