slam38 Posted October 6, 2009 Report Share Posted October 6, 2009 (edited) view storeview cartclear cart ';}function render_footer(){ return ' Edited October 6, 2009 by slam38 Quote Link to comment Share on other sites More sharing options...
mcChris Posted October 6, 2009 Report Share Posted October 6, 2009 i'm still a bit new to php, but i've heard that 'headers already sent' is usually a white space problem...try putting 'session_start();' on the same line as '/** FUNCTIONS **/' and return directly after the slash... Quote Link to comment Share on other sites More sharing options...
falkencreative Posted October 7, 2009 Report Share Posted October 7, 2009 As mcChris said, this error often means you accidentally have an extra space before the session_start() function. I would check that those files above don't have any blank lines/spaces before the opening <?php tag, or possibly any blank lines / spaces after the closing ?> tag in templates.php. As a sidenote, although the shopping cart tutorial doesn't go into this, it is sometimes a php best practice to leave out the closing PHP tag ("?>") in PHP pages -- it really isn't necessary. (This only applies to pages that are fully PHP, and include no html. You could drop the closing PHP tag on all three PHP pages above.) It's quite easy for extra spaces to end up on the end of a file, and if you're using several includes, tracking these spaces down can be a pain, especially if you're dealing with lots of files. Spaces after closing PHP tags is known to cause various issues including invalid headers like you are encountering... Quote Link to comment Share on other sites More sharing options...
slam38 Posted October 7, 2009 Author Report Share Posted October 7, 2009 Thankyou Falfencreate, and McChris, for getting back to me I will try what you have suggested. Just as an after thought is there a specific way to find and get rid of the white space or do I just do through the file and delete where I think it might be? Thanks again. Quote Link to comment Share on other sites More sharing options...
mcChris Posted October 7, 2009 Report Share Posted October 7, 2009 (edited) i uploaded my 'magic cart' to my web server for further testing and ran into this 'headers already sent' issue myself... after following falkencreative's solutions the issue didn't resolve...then i found this: http://www.phpbuilder.com/board/showthread.php?t=10310794 ...post #8 was what caused my headers to be sent...there are other ideas there too... Edited October 7, 2009 by mcChris Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.