2009-10-11
携帯サイトのDOCTYPE分岐方法
なんか面白そうだったので乗ってみる
http://ma-san.org/2009/10/htmlphpdoctype.html
$LIB_MPの詳細はこっち
http://d.hatena.ne.jp/aquarn/20080523/1211556411
<?php $htmltype = $LIB_MP->get("htmltype"); if($htmltype == 'XHTML'){ if($LIB_MP->get("carrier") == 'DOCOMO'){ header("Content-type: application/xhtml+xml"); echo '<?xml version="1.1" encoding="Shift_JIS"?>'."\n"; echo '<!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/1.1) 1.1//EN" "i-xhtml_4ja_10.dtd">'."\n"; }elseif($LIB_MP->get("carrier") == 'EZWEB'){ echo '<?xml version="1.1" encoding="Shift_JIS"?>'."\n"; echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">'."\n"; }elseif($LIB_MP->get("carrier") == 'SOFTBANK'){ echo '<?xml version="1.0" encoding="Shift_JIS"?>'."\n"; echo '<!DOCTYPE html PUBLIC "-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN" "xhtml-basic-10-plus.dtd">'."\n"; } echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">'."\n"; echo '<head>'."\n"; echo '<style type="text/css"> <![CDATA[ a:link { color:#FF0000; } a:visited { color::#FF0000; } a:focus { color:#000000; } ]]> </style>'."\n"; }else{ header("Content-type: text/html"); echo '<html>'."\n"; echo '<head>'."\n"; } ?>
的な感じ?
仕事で使ってるのは全部これだなぁ
XHTML端末とHTML端末を一応切り分けてるので後のコーディングは一緒。
後はこの辺読むと結構楽に携帯のHTMLやらXHTMLやらが取り回せるかも かも
http://d.hatena.ne.jp/aquarn/20090805/1249499424
後はこことか
http://labs.pakureserve.jp/archives/325
こことか
http://labs.pakureserve.jp/archives/47
こことか
トラックバック - http://d.hatena.ne.jp/aquarn/20091011/1255213950
リンク元
- 47 http://ma-san.org/2009/10/htmlphpdoctype.html
- 38 http://ke-tai.org/blog/2009/10/14/doctype/
- 16 http://ke-tai.org/
- 5 http://reader.livedoor.com/reader/
- 3 http://b.hatena.ne.jp/entry/ma-san.org/2009/10/htmlphpdoctype.html
- 3 http://www.google.co.jp/ig/gmailmax?mid=129&th=12440b3f7bd96ba9
- 3 http://www.google.co.jp/reader/view/
- 2 http://d.hatena.ne.jp/yabeken/edit?date=20091013
- 2 http://delicious.com/save?jump=yes&v=4;url=http://d.hatena.ne.jp/aquarn/20091011/1255213950;title=携帯サイトのDOCTYPE分岐方法 - ある人の?%8
- 2 http://green.search.goo.ne.jp/search?from=eco_search&IE=UTF-8&MT=<?+echo+"<?xml+version=\"1.0\"+encoding=\"Shift_JIS\"?>\n";+?>&submit.x=0&submit.y=0

携帯サイトのコーディングでいつも苦労させられるので他の方の考えを聞いてみたいと思いエントリーしました><
すごく参考になります!