CodeIgniter Forums

Full Version: Message: Cannot modify header information - headers already sent by
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Coder Death[/eluser]
Please
Tell me why am i getting this error ?

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\www\_app\_app_files\controllers\w_display.php:2)

Filename: libraries/Session.php

Line Number: 672


Locally in works but on the server online it displays the erroe

El Forum

[eluser]CroNiX[/eluser]
Are you echoing something directly from the controller?

El Forum

[eluser]weboap[/eluser]
echoing something from the controller as @CrNix said, or you have space before <?php

El Forum

[eluser]InsiteFX[/eluser]
Or you are saving your files with the BOM! In this case do a view source and you should see funny characters at the very top of the file.

El Forum

[eluser]Coder Death[/eluser]
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class W_Display extends CI_Controller {
  
    public function _contruct(){
        parent::__construct();
    }
    public function index()
    {

        $this->template->render();
    }    
}

?>

Hi thanks a lot the problem was the space before the <?php?> I remove it and it seems to work. Why do I not get this kind of error on my computer? it is only when I upload the server.

Thank you

El Forum

[eluser]Coder Death[/eluser]
Anyway, another problem is on the links.
When I am on the home page , all the links work fine but if I enter one link and try from that page to enter another link it gets error.
I explain
My home page
Code:
localhost/index.php
, when i point to Link1 the address is showing
Code:
localhost/index/controller/link1
. That is ok
But if I enter Link1 and point now on link2 the link displays is
Code:
localhost/index/controller/link1/index/controller/link1
What am I ignoring in the configuration? Please
My config file is set to
Code:
$config['index_page'] = 'index.php';
How can I remove it and make that it does not appear in my links anymore?

El Forum

[eluser]weboap[/eluser]
http://ellislab.com/codeigniter/user-gui...elper.html

Code:
//load in your controller or autoload...
$this->load->helper('url');

Code:
echo anchor('/controller/link1', 'My link1', 'title="my link 1 title"');

echo anchor('/controller/link2', 'My link2', 'title="my link 2 title"');