It looks exactly the same!
I just completely rewrote about 90% of the code behind this site. Doesn't look very different though does it?
Well to begin with it's my first attempt at writing Object-Oriented PHP. I only have 4 classes in this code (class Page
, class HTMLpage extends Page
, class CSSpage extends Page
, class RSSpage extends Page
) but it has at least been a "learning experience" for me.
Secondly, the weblog now sends various <link>
elements which allow navigation of the weblog using Mozilla's (or Opera's) Site Navigation toolbar.
Thirdly, the weblog navigation itself has been simplified (it no longer uses 4 separate forms to do the job) which should help accessibility a bit.
Finally, as before, if this site detects that your user agent (browser) supports XHTML (with a Content-type
of "application/xhtml+xml
") it will send the page as XHTML 1.1. However if it detects that your browser does not support XHTML, it will instead send the page as 100% valid HTML 4.01. I'm fairly confident that this is the only weblog that does this (feel free to prove me wrong on this). Whether it was actually worth doing is another matter altogether ☺.
Note that you can force the site into either XHTML or HTML mode by adding a GET parameter of "force=xhtml" or "force=html" respectively.
Posted: 2003-01-10 07:41:40 UTC by Xiven | Cross-references (3) | Comments (3)
Cross-references
- Pingback: xiven.com - weblog: These Unforgettable Days... (2003-03-21 14:31:39 UTC)
- Pingback: xiven.com - weblog: Research says that shows with X in the name get higher ratings. (2003-05-06 15:35:43 UTC)
- Pingback: Someone should give those pig's landing permission - Kam Check! - Weblog - Exploding-Planet.com (2003-05-10 19:40:25 UTC)
Comments
Xial // Cedaeus (2003-02-13 06:42:42 UTC)
Here's a question for you:
I need some tips on how to detect useragents, so that I can properly serve my pages as well. However, I'm not even sure as to how to detect them, as I am far from any sense of good with PHP.
Thanks to the overwhelming number of Internet Explorer users whom I can not convince as to the faults and fallacies of that browser, this makes for a difficulty in my case.
Would you have any tips as to how I can arrange something of that order, so I can become "visible to the world" again?
Thank you, very much.
- X/C
Xiven (Registered) (2003-02-14 17:31:55 UTC)
Well, in PHP something along the lines of the following would probably do the job:
if(isset($_SERVER['HTTP_USER_AGENT'])) {
if(strstr($_SERVER['HTTP_USER_AGENT'],"Googlebot")) {
$useragent = 'Google';
} elseif(strstr($_SERVER['HTTP_USER_AGENT'],"W3C_Validator")) {
$useragent = 'W3C_Validator';
} elseif(strstr($_SERVER['HTTP_USER_AGENT'],"WDG_Validator/")) {
$useragent = 'WDG_Validator';
} elseif(strstr($_SERVER['HTTP_USER_AGENT'],"Opera")) {
$useragent = 'Opera';
} elseif(strstr($_SERVER['HTTP_USER_AGENT'],"MSIE")) {
$useragent = 'IE';
} elseif(strstr($_SERVER['HTTP_USER_AGENT'],"Safari/")) {
$useragent = 'Safari';
} elseif(strstr($_SERVER['HTTP_USER_AGENT'],"Gecko/")) {
$useragent = 'NS6';
} elseif(strstr($_SERVER['HTTP_USER_AGENT'],"Mozilla")) {
if(strstr($_SERVER['HTTP_USER_AGENT'],"Mozilla/4")) {
$useragent = 'NS4';
} else {
$useragent = 'UNK';
}
} else {
$useragent = 'UNK';
}
} else {
$useragent = 'UNK';
}
Anonymous (2003-11-03 10:05:15 UTC)
<?php
// a much more cleaner code. i suppose
if(isset(($_SERVER['HTTP_USER_AGENT'])
{
$browser = 'unk';
$browsers_array = array('msie','netscape','safari','gecko','opera','W3C_VALIDATOR','W3D_VALIDATOR','Googlebot');
foreach($browsers_array as $browserdetected)
{
if (stristr($_SERVER['HTTP_USER_AGENT'],$browserdetected))
{
$browser = $browserdetected;
}
}
}
$useragent = $browser;
// well define it like that if $useragent is your variable
?>