View previous topic :: View next topic |
Author |
Message |
kena Smarty Rookie
Joined: 29 Apr 2005 Posts: 19
|
Posted: Mon Jul 30, 2007 8:59 am Post subject: Headers alreay sent |
|
|
Hi,
I have a problem with my header() function. It doesn't work.
Code: | Warning: Cannot modify header information - headers already sent by (output started at /var/www/faq/templates_c/%%45^45E^45E480CD%%index.tpl.php:11) in /var/www/faq/public_html/article.php on line 10 |
where line 11 in index.tpl.php is:
Code: | <meta name="description" content="Welkom op de website van Faith Answers & Questions."> |
and line 10 in article.php is:
Code: | header('Location: index.php'); |
I don't understand what is wrong. Can anybody help me?
Thanks
Alex |
|
Back to top |
|
Celeb Administrator
Joined: 17 Apr 2007 Posts: 1025 Location: Vienna
|
Posted: Mon Jul 30, 2007 9:08 am Post subject: |
|
|
You may not have sent anything to the client before the header() statement. So it must be before any echo command or smarty->display(). _________________ Darn computers always do what I tell them to instead of what I want them to do. |
|
Back to top |
|
kena Smarty Rookie
Joined: 29 Apr 2005 Posts: 19
|
Posted: Mon Jul 30, 2007 9:51 am Post subject: |
|
|
Celeb wrote: | You may not have sent anything to the client before the header() statement. So it must be before any echo command or smarty->display(). | I know that something was sent prior to the header(), but I don't know what?! I cannot be the <meta name> that is for sure! |
|
Back to top |
|
Celeb Administrator
Joined: 17 Apr 2007 Posts: 1025 Location: Vienna
|
Posted: Mon Jul 30, 2007 10:36 am Post subject: |
|
|
Why is that so sure? PHP seems to disagree with you on that point. What else would you want to do with that line other than sending it to the client?
Maybe you can posat some more code than these two lines so we have a chance of spotting the problem. _________________ Darn computers always do what I tell them to instead of what I want them to do. |
|
Back to top |
|
kena Smarty Rookie
Joined: 29 Apr 2005 Posts: 19
|
Posted: Mon Jul 30, 2007 10:56 am Post subject: |
|
|
Celeb wrote: | Maybe you can post some more code than these two lines so we have a chance of spotting the problem. | I will, thanks. But it will be tonight when i'm at home.
Gr. Alex |
|
Back to top |
|
kena Smarty Rookie
Joined: 29 Apr 2005 Posts: 19
|
Posted: Mon Jul 30, 2007 7:05 pm Post subject: |
|
|
I figured it out. I forgot to enter:
on top of the page. Once I did that everything worked fine!
Thankx,
Alexander |
|
Back to top |
|
chrisjenx2001 Smarty Rookie
Joined: 19 Nov 2007 Posts: 6
|
Posted: Tue Nov 27, 2007 6:42 pm Post subject: |
|
|
I have to say that ob_start(); fixed about 10 problems i was having lol.
I'm super happy now!! |
|
Back to top |
|
master_kaos Smarty Regular
Joined: 02 Aug 2007 Posts: 54
|
Posted: Tue Nov 27, 2007 7:06 pm Post subject: |
|
|
a common problem to this is u may have 1 space or 1 enter key before a <?php tag which counts as output |
|
Back to top |
|
chrisjenx2001 Smarty Rookie
Joined: 19 Nov 2007 Posts: 6
|
Posted: Tue Nov 27, 2007 8:24 pm Post subject: |
|
|
This is alittle beyond headers but it seems to be causeing the problem.
Code: |
function login ($params,&$smarty){
$this->login_f($params['username'],$params['password'],$login_error,$logerror){
$smarty->assign('login_msg',$login_error);
$smarty->assign('logerror',$logerror);
header("location: index.php?action=loginerror®ister_user=on");
}
|
i take it the $smarty-assign are never handed back because before it can complete the function the script is redirected?
is that so? as if i remove the header statment the values are returned.
is there anyway to hand the results back to the page i redirect to? |
|
Back to top |
|
Celeb Administrator
Joined: 17 Apr 2007 Posts: 1025 Location: Vienna
|
Posted: Wed Nov 28, 2007 11:09 am Post subject: |
|
|
Use Session variables (server side) or the Querystring (take roundtrip to the client = security critical) of the page you redirect to. _________________ Darn computers always do what I tell them to instead of what I want them to do. |
|
Back to top |
|
|