/** * Content-Typeの設定 * @return null */ private function _setContentType() { $response = $this->getContext()->getResponse(); if (sfJpMobile::isDocomo()) { // TODO XHTML対応機種かどうかの判別を入れる $response->setHttpHeader("Content-Type", "application/xhtml+xml; charset=Shift_JIS"); $response->setContentType("application/xhtml+xml; charset=Shift_JIS"); } else { if (sfJpMobile::isKddi()) { $response->setHttpHeader("Content-Type", "text/html; charset=Shift_JIS"); $response->setContentType("text/html; charset=Shift_JIS"); } else { $response->setHttpHeader("Content-Type", "text/html; charset=UTF-8"); $response->setContentType("text/html; charset=UTF-8"); } } }
<?php echo '<?xml version="1.0" encoding="Shift_JIS"?>'; if (sfJpMobile::isDocomo()) { ?> <!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/1.1) 1.0//EN" "i-xhtml_4ja_10.dtd"> <?php } elseif (sfJpMobile::isKddi()) { ?> <!DOCTYPE html PUBLIC "-//OPENWAVE//DTD XHTML 1.0//EN" "http://www.openwave.com/DTD/xhtml-basic.dtd"> <?php } elseif (sfJpMobile::isSoftbank()) { ?> <!DOCTYPE html PUBLIC "-//JPHONE//DTD XHTML Basic 1.0 Plus//EN" "xhtml-basic10-plus.dtd"> <?php } else { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php } ?> <?php /* $Id$ */ /* vim:set expandtab tabstop=2 softtabstop=2 shiftwidth=2: */