CodeIgniter Forums
I can't use (redirect) and language helper in the same time ! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: I can't use (redirect) and language helper in the same time ! (/showthread.php?tid=31402)



I can't use (redirect) and language helper in the same time ! - El Forum - 06-17-2010

[eluser]Zied[/eluser]
Hi!
with this code redirect work very nice
Code:
<?php

class Test extends Controller
{
    function __construct()
    {
        parent::Controller();
        
    }

    function index()
    {
        echo redirect('navigation');
    }
}
Bat with this code I have this message:
Code:
<?php

class Test extends Controller
{
    function __construct()
    {
        parent::Controller();
        $this->lang->load('navigation1');
    }

    function index()
    {
        echo redirect('navigation');
    }
}
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /homez.344/edenclub/www/application/language/french/navigation1_lang.php:1)

Filename: helpers/url_helper.php

Line Number: 541


I can't use (redirect) and language helper in the same time ! - El Forum - 06-17-2010

[eluser]mddd[/eluser]
You probably have some whitespace in your language php document.
Make sure there is absolutely nothing (no space, no enter) before the <?php tag or after the ?> tag!
If there is anything, your redirect header will not work.

Also, why are you writing 'echo redirect(...)' ?? There is nothing to echo, you should just write: redirect(....);


I can't use (redirect) and language helper in the same time ! - El Forum - 06-17-2010

[eluser]WanWizard[/eluser]
Output started at position 1 of a file is usually a file saved in UTF-8 with a BOM header. Tell your editor to save it without one...


I can't use (redirect) and language helper in the same time ! - El Forum - 06-17-2010

[eluser]Zied[/eluser]
[quote author="mddd" date="1276808456"]You probably have some whitespace in your language php document.
Make sure there is absolutely nothing (no space, no enter) before the <?php tag or after the ?> tag!
If there is anything, your redirect header will not work.

Also, why are you writing 'echo redirect(...)' ?? There is nothing to echo, you should just write: redirect(....);[/quote]
I'm sure that i having any whitespace in my language php document.
This code work in localhost ( with WAMP) bat not in WEBSERVER (OVH)


I can't use (redirect) and language helper in the same time ! - El Forum - 06-17-2010

[eluser]WanWizard[/eluser]
It works? Or you don't see the warning?

Do me a favour, and check the file. Given the fact that you work on Windows, quite possible that it is a UTF-8 BOM header...


I can't use (redirect) and language helper in the same time ! - El Forum - 06-17-2010

[eluser]Zied[/eluser]
[quote author="WanWizard" date="1276808602"]Output started at position 1 of a file is usually a file saved in UTF-8 with a BOM header. Tell your editor to save it without one...[/quote]
I'm don't understand "BOM".
I used Dreamweaver to write my code.
My view files have UTF-8.


I can't use (redirect) and language helper in the same time ! - El Forum - 06-17-2010

[eluser]Eric Barnes[/eluser]
Try this: http://juicystudio.com/article/utf-byte-order-mark.php


I can't use (redirect) and language helper in the same time ! - El Forum - 06-18-2010

[eluser]Zied[/eluser]
Thanks, the problem is UTF-8 with a BOM header.
Now, I use Notepad++ with UTF-8 (without a BOM).
Thanks a lot my friends.