{"id":425,"date":"2008-02-18T23:01:58","date_gmt":"2008-02-19T05:01:58","guid":{"rendered":"http:\/\/www.codedread.com\/blog\/archives\/2008\/02\/18\/new-xhtmlsvg-theme\/"},"modified":"2008-02-18T23:01:58","modified_gmt":"2008-02-19T05:01:58","slug":"new-xhtmlsvg-theme","status":"publish","type":"post","link":"https:\/\/www.codedread.com\/blog\/archives\/2008\/02\/18\/new-xhtmlsvg-theme\/","title":{"rendered":"New XHTML+SVG Theme"},"content":{"rendered":"<p><object type=\"image\/svg+xml\" width=\"100\" height=\"100\" align=\"right\" hspace=\"10\" data=\"http:\/\/codedread.com\/clipart\/party.svgz\"><span\/><\/object>I've been tinkering at a new theme for <a href=\"http:\/\/www.codedread.com\/\">my website<\/a> since the Christmas holidays and finally got around to flipping the switch this weekend.  I decided to try my hand, for the first time, at real XHTML served as application\/xhtml+xml but with PHP content negotiation to text\/html for poor ol' Internet Explorer.  <!--more--><\/p>\n<p>I like the idea of having a seamless transition between my blog and website. so this evening I decided to flip the switch on the blog, even though the WordPress theme is very much a work-in-progress.  I still need to figure out what to do with the sidebar,  but I can always hack away on the theme on my old blog installation internally and publish updates once they have been verified on a set of decent browsers (Firefox 2+, Opera 9+, Safari 3+).<\/p>\n<p>I use <a href=\"http:\/\/www.w3.org\/Graphics\/SVG\" title=\"Scalable Vector Graphics\">SVG<\/a> in a bunch of different places:  inline as decoration around the page (the blue gradient and the title) and referenced (via &#60;object&#62;) for the icon menu (at the top) and W3C validation badges (at the bottom).  Once I nail down all the particulars, I'll compress <a href=\"http:\/\/www.codedread.com\/menu.svg\" title=\"SVG-enabled icon menu\">menu.svg<\/a> and serve only menu.svgz so it can be neatly cached (at roughly 15kb).  But I'll keep menu.svg around for web developers to look at if they're curious.<\/p>\n<p>Work on this led to a few bugs reported at Mozilla, WebKit and Opera - but no show stoppers.  The best user experience is in Opera 9.5.  For the first time, I'm using declarative animation (in a simple way) for icon mouse-hovering.  Firefox and Safari users miss out for now, unfortunately.<\/p>\n<p>It turns out, as <a href=\"http:\/\/realtech.burningbird.net\/standards\/adventures-in-xhtml\/\">Shelley has mentioned<\/a>, that the best developer experience to work on XHTML is also (by far) Opera.  Instead of Firefox's \"yellow screen of death\" we're greeted with Opera's \"light grey screen of mild achiness\".  Instead of cryptic messages about unexpected tags, the element which failed to be terminated and the tag that broke the XML parsing are highlighted for you.<\/p>\n<p>I encountered some funniness when I tried to validate my pages on the <a href=\"http:\/\/validator.w3.org\/\">W3C Validator<\/a>.  Apparently it thought they were text\/html pages.  So I had to add a little catch in my PHP content negotiation code to force application\/xhtml+xml when I want to.  Anyway, the PHP content negotiation code looks like this:<\/p>\n<div class=\"code\">&#60;?php<br \/>if( (!stristr($_SERVER[\"HTTP_ACCEPT\"],\"application\/xhtml+xml\") &#38;&#38; <br \/>&#160;&#160;&#160;&#160; !isset($_GET['xhtml'])) &#124;&#124; $_GET['xhtml'] === '0' )<br \/>{<br \/>&#160;&#160;header(\"Content-Type: text\/html;charset=utf-8\");<br \/>&#160;&#160;header(\"Vary: Accept\");<br \/>&#160;&#160;printf(\"&#60;!DOCTYPE HTML PUBLIC \\\"-\/\/W3C\/\/DTD HTML 4.01\/\/EN\\\"\".<br \/>&#160;&#160;&#160;&#160;\" \\\"http:\/\/www.w3.org\/TR\/html4\/strict.dtd\\\"&#62;\\n\");<br \/>&#160;&#160;printf(\"&#60;html lang=\\\"en\\\"&#62;\\n\");<br \/>}<br \/>else <br \/>{<br \/>&#160;&#160;header(\"Content-Type: application\/xhtml+xml;charset=utf-8\");<br \/>&#160;&#160;header(\"Vary: Accept\");<br \/>&#160;&#160;printf(\"&#60;\" . \"?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" ?\" . \"&#62;\\n\");<br \/>&#160;&#160;printf(\"&#60;!DOCTYPE html PUBLIC \\\"-\/\/W3C\/\/DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1\/\/EN\\\"\" .<br \/>&#160;&#160;&#160;&#160;\"\\\"http:\/\/www.w3.org\/2002\/04\/xhtml-math-svg\/xhtml-math-svg.dtd\\\"&#62;\\n\");<br \/>&#160;&#160;printf(\"&#60;html xmlns=\\\"http:\/\/www.w3.org\/1999\/xhtml\\\" xmlns:svg=\\\"http:\/\/www.w3.org\/2000\/svg\\\"\" .<br \/>&#160;&#160;&#160;&#160;\" xmlns:xlink=\\\"http:\/\/www.w3.org\/1999\/xlink\\\" xml:lang=\\\"en\\\"&#62;\\n\");<br \/>}<br \/>?&#62;<\/div>\n<p>You might find some of my old site themes amusing, sad, or boring:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.codedread.com\/archive\/2004-04\/\">2004-04<\/a> - Early static HTML, table-based layout, no CSS.<\/li>\n<li><a href=\"http:\/\/www.codedread.com\/archive\/2005-04\/\">2005-04<\/a> - Reworked into a templated PHP site.  Eventually I turned it from table-based to CSS layout-based (snapshot is table-based).<\/li>\n<li><a href=\"http:\/\/www.codedread.com\/archive\/2006-01\/\">2006-01<\/a> - Theme from 2006.  Using CSS for layout.  Embedded SVG aqua buttons for navigation menus.  All modern browsers now support the features I was using on this page.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been tinkering at a new theme for my website since the Christmas holidays and finally got around to flipping the switch this weekend. I decided to try my hand, for the first time, at real XHTML served as application\/xhtml+xml but with PHP content negotiation to text\/html for poor ol&#8217; Internet Explorer.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,41,44,25,46,11,28,30],"tags":[195,198,164,165],"class_list":["post-425","post","type-post","status-publish","format-standard","hentry","category-firefox","category-opera","category-safari","category-software","category-svg","category-technology","category-web","category-xml","tag-php","tag-svg","tag-wordpress","tag-xhtml"],"_links":{"self":[{"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/posts\/425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/comments?post=425"}],"version-history":[{"count":0,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/posts\/425\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/media?parent=425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/categories?post=425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/tags?post=425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}