XHTMLOutput
<< | Cookbook-V1 | >>
Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.
Contents
Goal
Change PmWiki so that it outputs XHTML instead of HTML documents.
Solution
Add the following to local.php:
[ = $HTMLDoctypeFmt = '<?xml version="1.0" encoding="iso-8859-1" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>'; $HTTPHeaders[] = "Content-Type: text/html; charset=iso-8859-1"; =]
Discussion
(This modification only works for pmwiki-0.5 releases and later.)
The first statement changes the document type declaration to be an XHTML document (instead of HTML) as recommended in http://www.w3.org/TR/2000/REC-xhtml1-20000126/#docconf.
Of course, you can change the character encodings specified above to be UTF-8 or UTF-16 or whatever is appropriate for your environment.
PmWiki does its best to make sure that it outputs valid XHTML, but it's always possible for an author to give markup sequences that result in invalid XHTML (e.g., improperly nested inline markup). At present Pm has decided that the amount of work needed to have PmWiki fix/avoid these situations is not worth the benefit received.
I would either leave out standalone="no" or make it standalone="yes". XHTML recommendation gives no statement about this. But standalone="yes" means, that all information is in the file, while standalone="no" means, that the processing might be dependant e.g. on DTD defaults. --Bernhard Weichel
When adding this to local/config.php, make sure to remove the [=s, and make it into 2 lines: 1 for $HTMLDoctypeFmt, another for $HTTPHeaders[]. Otherwise it may break things in interesting ways.
--Bronwyn Boltwood
See Also
- http://validator.w3.org/check/referer - validate this page as XHTML 1.0 Transitional
- http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020801/ - XHTML Media Types
Contributors
Browser Compatibility
This page is configured as an XHTML document as described above. Here we can record the document's compatibility with various browsers--just record your browser version below.
- IE 6.0.2800/Win2000 - works (Pm)
- Note that IE changes its rendering of the page slightly if XHTML/XML is specified as the DOCTYPE. --Pm
- IE 6.0.2800/WinXP - works
- Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120
- Netscape/7.01 - works (GeoHop)
- Safari/1.0 (v85)/Mac OSX
- Mozilla/5.0 Galeon/1.2.7 (X11; Linux i686; U;) Gecko/20021203 (rgr)
- Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3.1) Gecko/20030425 - works
- Mozilla/4.0 (compatible; MSIE 5.5; Windows 98) - works
- Opera/7.11 - works
- Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6 (works, but I wonder why we are recording this, this is not a complex document to display, anthony liekens)
- Safari/1.2 (v125)/Mac OS X - works, but advertises itself as HTML 4.01 Transitional and does not pass the W3 Consortium validator!
- fixed now; didn't have the cookbook extension enabled. --Pm
- Looks like it's disabled again.
pmwiki-2.4.4 -- Last modified by {{jc}}?