Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Plugin support
  3. » phw_DTD

#1 2004-11-02 13:13:00

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,162
Website

phw_DTD

A plugin that allows serving Textpattern documents as application/xhtml+xml, with a DTD of XHTML1.1 to browsers that support it. Other browsers just get XHTML1.0 with text/html as mime type. See also this thread.

Additionally, the plugin use ob_gzhandler to compress(gzip) the files as send to the browsers. (saves a bit of bandwidth…)
This plugin use a variation of the Keystone method.

To use
  • in your page templates, delete everything you have at the top of the document, including the opening [head] tag, and replace by [txp:phw_dtd /];
  • You’ll need to modify one Textpattern file: publish.php (on line 170, it is sending headers as text/html; the line can be commented out, as the plugin will take care of those headers.

==============
//comment out the following line in textpattern/publish.php
// header(“Content-type:text/html; charset=utf-8”);

==============

<del>download phw_DTD.txt.gz .</del>

==============

[edit 20050918] Updated for Textpattern 4.0, see post below

Last edited by phiw13 (2005-09-18 01:31:37)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#2 2004-11-03 00:37:07

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: phw_DTD

Looks good. Just to clarify a couple of things for me. When you say remove the opening “head” tag I presume you don’t mean the whole of the “head” section just the “opening” tag.

This “ob_gzhandler”. Do I need to do anything for this to work or is it an automatic thing via PHP to the server? Nice site by the way. :grin:


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2004-11-03 00:45:15

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,162
Website

Re: phw_DTD

1. just the opening [head] tag, not the whole section :-)

2. “ob_gzhandler”, no you don’t need to do anything more. I use it because my servers are not configured to use mod_gzip and partners.

If your server use mod_gzip (like textdrive does), then you can delete the line.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#4 2004-11-03 01:10:52

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: phw_DTD

OK. Thanks for that.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#5 2005-02-19 11:15:03

ubernostrum
Member
From: Lawrence, KS
Registered: 2004-05-05
Posts: 238
Website

Re: phw_DTD

Philippe: I notice you’ve got the XML prolog in there, which will toss IE into quirks mode. As I’d always understood it, if you’re serving UTF-8 or specifying your charset via the Content-Type header then the prolog is not necessary. Or is it?


You cooin’ with my bird?

Offline

#6 2005-02-19 11:37:56

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,162
Website

Re: phw_DTD

1/ The xml prolog should only appear for Gecko and Opera with that plugin. All others get text/html without prolog.

2/ I could be wrong, but for application/xhtml+xml, the prolog is required, as we’re dealing with xml here. For text/html, it is a different matter, sending the charset via the Content-Type header is tecnically enough.

Although it is not a bad practice to add it (the charset) as a meta tag, or within the xml prolog. Just in case the user saves the document on the local drive.
(I think this is correct, strong fever and a bout of flu, brain is kind of running on low power).

P.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#7 2005-02-19 11:54:17

ubernostrum
Member
From: Lawrence, KS
Registered: 2004-05-05
Posts: 238
Website

Re: phw_DTD

Looking at the spec, I’m not really sure:

Definition: XML documents should begin with an XML declaration which specifies the version of XML being used.

And then it shows two examples which are said to be well-formed: one with the prolog and one without. I’m guessing that means it the prolog can be omitted, but I’ll have to research it some more to be certain.

Good point about saving the document, though, I may leave it in for that…

Edit: I’ve got this working on my site now, though I edited the plugin to always send an XHTML 1.0 Strict DOCTYPE and to include the XFN Profile in the head tag, since I’m trying to figure out a way to integrate that now that I can do arbitrary HTML with Markdown… I did decide to leave the prolog in for conforming browsers.

Last edited by ubernostrum (2005-02-19 12:53:17)


You cooin’ with my bird?

Offline

#8 2005-02-19 14:05:27

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,162
Website

Re: phw_DTD

about the xml declaration, form the xhtml1.0 specs

An XML declaration is not required in all XML documents; however XHTML document authors are strongly encouraged to use XML declarations in all their documents. …

And in the Xhtml 1.1 document, there is a sample piece of code, including the xml declaration.
link

It is a good thing to leave it in.

Note: if you use XHTML 1.0 Strict, you can even use an ID on the html tag …


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#9 2005-02-19 14:10:00

ubernostrum
Member
From: Lawrence, KS
Registered: 2004-05-05
Posts: 238
Website

Re: phw_DTD

From the second link you provided:

Such a declaration is required when the character encoding of the document is other than the default UTF-8 or UTF-16.

So XHTML 1.1 is stricter than XML? I was under the impression that XML would allow you to omit the declaration, even on non-UTF documents, if you were specifying the encoding via a “higher” protocol like HTTP

But then character encoding issues in XML are a mess, so I guess I shouldn’t be surprised that there aren’t clear answers.


You cooin’ with my bird?

Offline

#10 2005-02-19 21:30:40

Etz Haim
Archived Plugin Author
From: Karlstad, Sweden
Registered: 2005-01-24
Posts: 262
Website

Re: phw_DTD

Can you use both zem_redirect and this one? Under which order should they be put in the page?

Offline

#11 2005-02-20 00:29:06

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,162
Website

Re: phw_DTD

I haven’t tried zem_redirect myself, but I guess that it should work. Put zem_redirect first, followed by phw_DTD at the very top of your template.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#12 2005-05-14 19:13:08

davidm
Member
From: Paris, France
Registered: 2004-04-27
Posts: 719

Re: phw_DTD

This plugin was exactly what I was looking for

Thanks phiw13 !


.: Retired :.

Offline

  1. Index
  2. » Plugin support
  3. » phw_DTD

Board footer

Powered by FluxBB