• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
error in header

#1
[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">&nbsp;</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">
                                    &lt;?php echo form_open('login/checkdata'); ?&gt;
                                    &lt;?php $data = array('name'=>'username', 'class'=>'login_inpt', 'value'=>set_value('username')); ?&gt;
                                        &lt;?php echo form_input($data); ?&gt;
                                </td>
                                <td width="25%" align="right"><img src="&lt;?php echo base_url('assets/images').'/user-nme.png'; ?&gt;"></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">
                                    &lt;?php $data = array('name'=>'password', 'class'=>'login_inpt'); ?&gt;
                                    &lt;?php echo form_password($data); ?&gt;
                                </td>
                                <td width="25%" align="right"><img src="&lt;?php  echo base_url('assets/images').'/pass.png'; ?&gt;" 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="&lt;?php echo base_url('login/forget'); ?&gt;"><img src="&lt;?php  echo base_url('assets/images').'/forget.png'; ?&gt;"></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="&lt;?php echo base_url('users/add_new_user'); ?&gt;"><img src="&lt;?php  echo base_url('assets/images').'/new_user.png'; ?&gt;" ></a></td>
                            </tr>
                        </table>

                    </td>
                </tr>
                &lt;?php $bt = array('name' => 'submit','value' => '','class' => 'login_btn'); ?&gt;
                <tr><td align="left">&lt;?php echo form_submit($bt); ?&gt;</td></tr>
            </table>


        </td>
    </tr>
    &lt;?php $this->load->view('includes/footer'); ?&gt;

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??

#2
[eluser]skunkbad[/eluser]
When you load views from inside your view, try setting the third parameter to TRUE

#3
[eluser]CroNiX[/eluser]
you also might try autoloading the session class instead of manually in your controller.

#4
[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:
&lt;?php $this->load->view('includes/inside_header','',TRUE); ?&gt;

and it doesn't work

#5
[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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.