error in header - El Forum - 09-04-2012
[eluser]Mohammed Zayan[/eluser]
Hi All
I use this code in my controller
Code: <?php
//error_reporting(0);
class Login extends CI_Controller{
function __construct(){
parent::__construct();
$this->load->library('session');
$this->load->helper('url');
$this->load->model('site_model');
$this->load->helper('form');
$this->load->database();
}
function index(){
$data['page_title'] = "login";
$this->load->view('login_view', $data);
}
and this code in my view
Code: <?php $this->load->view('includes/inside_header'); ?>
<?php $this->load->view('includes/social_icons'); ?>
<table width="710px" border="0" align="center" cellspacing="0" cellpadding="0">
<tr>
<td height="250" align="center" valign="top"> </td>
</tr>
<tr>
<td align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="top" class="input_log_bg">
<table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
<?php echo form_open('login/checkdata'); ?>
<?php $data = array('name'=>'username', 'class'=>'login_inpt', 'value'=>set_value('username')); ?>
<?php echo form_input($data); ?>
</td>
<td width="25%" align="right"><img src="<?php echo base_url('assets/images').'/user-nme.png'; ?>"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="right" valign="top" class="input_log_bg">
<table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
<?php $data = array('name'=>'password', 'class'=>'login_inpt'); ?>
<?php echo form_password($data); ?>
</td>
<td width="25%" align="right"><img src="<?php echo base_url('assets/images').'/pass.png'; ?>" width="162" height="34"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="right" valign="top" class="input_log_bg">
<table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
</td>
<td width="25%" align="right"><a href="<?php echo base_url('login/forget'); ?>"><img src="<?php echo base_url('assets/images').'/forget.png'; ?>"></a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="right" valign="top" class="input_log_bg">
<table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
</td>
<td width="25%" align="right"><a href="<?php echo base_url('users/add_new_user'); ?>"><img src="<?php echo base_url('assets/images').'/new_user.png'; ?>" ></a></td>
</tr>
</table>
</td>
</tr>
<?php $bt = array('name' => 'submit','value' => '','class' => 'login_btn'); ?>
<tr><td align="left"><?php echo form_submit($bt); ?></td></tr>
</table>
</td>
</tr>
<?php $this->load->view('includes/footer'); ?>
when I play code I have this error
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /......./public_html/mosabaqh/application/controllers/login.php:1)
Filename: libraries/Session.php
Line Number: 672
and it doesn't appear in localhost it is appear online only
What is wrong in my code??
error in header - El Forum - 09-04-2012
[eluser]skunkbad[/eluser]
When you load views from inside your view, try setting the third parameter to TRUE
error in header - El Forum - 09-04-2012
[eluser]CroNiX[/eluser]
you also might try autoloading the session class instead of manually in your controller.
error in header - El Forum - 09-04-2012
[eluser]Mohammed Zayan[/eluser]
[quote author="skunkbad" date="1346812844"]When you load views from inside your view, try setting the third parameter to TRUE[/quote]
I make it
Code: <?php $this->load->view('includes/inside_header','',TRUE); ?>
and it doesn't work
error in header - El Forum - 09-05-2012
[eluser]Mohammed Zayan[/eluser]
[quote author="CroNiX" date="1346814884"]you also might try autoloading the session class instead of manually in your controller.[/quote]
Thank you,
Now it works.
|