01-18-2010, 12:59 AM
[eluser]Mithun[/eluser]
I uses DX Auth and Template Library http://www.williamsconcepts.com/ci/codei.../template/
I need set up a layout, there there is a user area that is displayed only for logged users. I have created the curresponding view in views/user_area.php and this view shows logged users name.
For getting this I need to setup the following code in every controller constructor.
How can I make this automated? editing the Template library code or setting up different layous for login and non-login pages?
this is my template layout file
I uses DX Auth and Template Library http://www.williamsconcepts.com/ci/codei.../template/
I need set up a layout, there there is a user area that is displayed only for logged users. I have created the curresponding view in views/user_area.php and this view shows logged users name.
For getting this I need to setup the following code in every controller constructor.
Code:
$this->load->library(array('template', 'DX_Auth'));
$data ['user_name'] = $this->dx_auth->get_username();
$this->template->write_view('user_area','user_area', $data);
this is my template layout file
Code:
<html>
<head>
<title><?php echo $title; ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/template.css" />
</head>
<body>
<div id="wrapper">
<div id="header">
<div id="user_area">
<?php echo $user_area;?>
</div>
<?php echo $header; ?>
<div id="tab_area">
<?php echo $tab_area;?>
</div>
</div>
<div id="main">
<div id="content">
<?php echo $content; ?>
</div>
</div>
<div id="footer">
<?php echo $footer; ?>
</div>
</div>
</body>
</html>