Topic: Problems after changing to "application/xhtml+xml" from "text/html"

I'm having an issue with PunBB.  When I change it so that the page is served as "application/xhtml+xml" instead of "text/html", the stylesheet gets completely messed up, almost none of the styles look correct.  This is on Firefox Beta 3 and Opera, MSIE doesn't care and displays it the usual way.

Also, if the page is being served as "text/html", is it really XHTML at all, or just funky HTML?

Re: Problems after changing to "application/xhtml+xml" from "text/html"

Could you link to the site?

3 (edited by Dwedit 2007-12-01 04:32)

Re: Problems after changing to "application/xhtml+xml" from "text/html"

I saw that it looked bad, and immediately reverted the hack so it's back to text/html now, but I have a somewhat related site:
This is using a php script to fetch news items off a punbb forum, and it uses punbb's stylesheets for the boxes.
Both sites have identical HTML content.  First site is served as "text/html", second site as "application/xhtml+xml"

http://www.dwedit.org/
http://www.dwedit.org/new_index2.php

You can see that the news boxes fail to show up on the second site in any browser other than IE.

EDIT:
I've just copied my message board to a second version.
First version:
http://www.dwedit.org/dwedit_board
Second version:
http://www.dwedit.org/dwedit_board_copy

In the copy, I added this line to the top of include/common.php.  Let me know if I did this change completely wrong.
header("Content-Type: application/xhtml+xml; charset=utf-8");

4

Re: Problems after changing to "application/xhtml+xml" from "text/html"

You need to alter the code for serving your stylesheet too. For xml, the stylesheet declaration needs to be like so. (The doctype declaration is there so you can see what your first three lines should look like). Obviously, the encoding type is dependant upon what you have set.

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="./style/default.css"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

I might add, serving it up as Xhtml1.1 will require a decent amount of work on the code, especially if you have installed any mods. The XML parser in the browser, (IE exempted), will throw an error on even the slightest typo, omission or html error, so unless you want to spend a good while going through the code, I'd suggest you stick to text/html. You will also need to make sure that everything printed to screen is html encoded if the output may contain any entities.

As to how a vanilla install of PunBB would fare, I honestly can't say, but a modded install will give you plenty of grief getting it ready. big_smile

Re: Problems after changing to "application/xhtml+xml" from "text/html"

Hmm, I have no problem with stylesheets on a site I'm developing and which is being served as application/xhtml+xml:
http://stringsandints.com/index3.php

Re: Problems after changing to "application/xhtml+xml" from "text/html"

Dwedit:
From the second version of your forum

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

You'll probably want to change that as well.
Also, you're lacking this at the top

<?xml version="1.0" encoding="UTF-8" ?>

Re: Problems after changing to "application/xhtml+xml" from "text/html"

I added that stuff, still broken.

Re: Problems after changing to "application/xhtml+xml" from "text/html"

Remove the xml-stylesheet stuff, it's redundant

9

Re: Problems after changing to "application/xhtml+xml" from "text/html"

Smartys wrote:

Remove the xml-stylesheet stuff, it's redundant

It's not redundant. It's merely a case of one or the other. The xml-stylesheet is the preferred method for XML, if I remember correctly?

Dwedit: With regards to stylesheets, you need to make sure everything in your stylesheets is in lowercase, btw.

Re: Problems after changing to "application/xhtml+xml" from "text/html"

It's not redundant. It's merely a case of one or the other.

What do you think redundant means? tongue

11 (edited by MattF 2007-12-01 23:40)

Re: Problems after changing to "application/xhtml+xml" from "text/html"

Smartys wrote:

What do you think redundant means? tongue

big_smile big_smile

I just personally think it seems neater to keep xml-style with xml and standard style with html, rather than same for both. smile