I’ve been trying all damn day to get anything (anything!) to render in Mozilla that I’ve written in MathML. Nothing. Even if I copy their stupid example page, it doesn’t render. WTF? Is is possible that I’m actually that lame of a writer? If I can’t figure this out, how is this supposed to be readily adopted by anyone?
And I read today that Microsoft is planning on having all of their Office suite save to XML file types for the next release. Good luck! If this is the wave of the future, I’m going to revert to tables and .gif spacer images. Suck a nut.
Calm down, man! It’ll be okay! It’s not your fault. You are writing the MathML right. It’s just that the web server is not serving your page as XML. So, the browser doesn’t know you’ve got XML in there and it’s just displaying it as HTML.
There are several ways to send the header info to the browser. One is to use PHP to send an extra header to the browser before it sends the page. To do this, you have to put this line of PHP:
header(“Content-type: application/xhtml+xml”);
at the *very* top of the page.
Problem is, if IE gets a page that is served as XML (i.e. Content-type: application/xhtml+xml), it gets completely confused because it doesn’t know what real XHTML is. So, you’d have to use PHP to determine what mime types the browser will accept. Then, conditionally send the header:
if (stristr($_SERVER[“HTTP_ACCEPT”],“application/xhtml+xml”)) {
header(“Content-type: application/xhtml+xml”);
} else {
header(“Content-type: text/html”);
}
I don’t know if all of that is going to come out looking right after I submit this form. I guess we’ll see. Give me a call if you want to discuss.
Cheers.
Okay, as I suspected, that PHP code did not come out right. There were some characters that WordPress threw out. I’ll have to send you the code in an email.
All this is not blatantly obvious to the guy who is reading “Learning php 5.” Thanks for all the help. I would call you tonight, but work the bed beckons (work tomorrow for the non-self employed).
So does php need some work in order to be more easily reckonciled with XML? I would expect this is a bit piecemill to be using a lot.
It’s not PHP that’s causing problems. It’s actually IE’s fault. If it weren’t for IE’s not being able to understand real XML, you could just tell Apache to serve all of your files as application/xhtml+xml. I’ll explain in more detail when we have a chance to talk on the phone.