Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Doctype problem & Headers issue


Recommended Posts

Hi all, I have searched on the forum and I see the familiar "Cannot modify header information..." message has been addressed. It is usually fixed as per the help at:


by removing the spaces at the start and end.


That is great and all, but though the message is the same, the circumstances are different. The DOCTYPE used (milestone 2.2) does not specify a URL, just simply transitional. This creates a bug in the web page that I am trying to adapt the store to. By adding the URL the issue is solved. However, rather than trying to edit each file that has a DOCTYPE statement (I am sure that is every page that creates an output) I thought of just using the standard header used for the rest of the site. I did this at the end of Application_top, so that it would be used everywhere, and would supercede the DOCTYPE on each page.


The problem is that when a redirect, such as I mentioned above, is required, I get the message complaining that the headers cannot be changed once output has started. Well, the redirect header instruction from general.php occurs first, near the start of application_top.php, but then I output the doctype directive at the end of application_top.php, and things blow up.


My question is:

HOW do I force the redirect immediately when the header is written rather than have the code continue on and get to my slice of code, triggering the problem?


Details: at the start of application_top.php, general.php is required. Line 29 has the redirect. My code is at the end of application_top.php.





Link to comment
Share on other sites

Hi, I tried to edit but couldn't find an edit option???


Anyway, it turns out the reason why this happened is that the general.php file is "required" where I said it was, but the redirect function is not called till after my DOCTYPE directive. Hence the problem.


It look like I will have to manually edit the files to fix it. I am surprised there isn't a standard header file for these items (the doctype and stylesheet)


Thanks to all who did look and try.



Link to comment
Share on other sites

  • 5 years later...

I had a doctype problem which was causing layout issues as well and found a solution which I'd like to share. I'm using OSC v2.2 and STS template system. I had problems to center my shop when using Internet Explorer because of the doctype problem.

I tried about 39 different doctypes and finally this one worked:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


Take care: Do never place any other HTML (not even commented out lines) before this line, otherwise Internet Explorer will change to another mode and will ignore the following doctype definition. The top of my sts_template.html file now looks like this:


<?php DEFINE ('STS_END_CHAR', '$'); ?>

<?php DEFINE ('STS_CONTENT_END_CHAR', '$'); ?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html $htmlparams$>



Hope this helps...

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...