This library provides emoji filter, ktai controller, mobile auth filter and so on. It may help your ktai web site.
protected//images/emojiphp_value mb_language "Japanese" php_value mbstring.detect_order "auto" php_value mbstring.http_input "pass" php_value mbstring.http_output "pass" php_value mbstring.internal_encoding "UTF-8" php_value mbstring.script_encoding "UTF-8" php_value mb_regex_encoding "UTF-8"
All filters depend on CHybridController, so you have to extends from CHybridController.
class MobileController extends CHybridController { public function filters() { return array( array( 'application.filters.ktai.AuthFilter', 'docomoOfficial'=>true, // if your site is KOSHIKI SAITO 'nonSupportBrowser'=>array( '/^DoCoMo\/1\.0(.*)$/', '/^J\-PHONE\/(.*)$/', '/^UP\.Browser\/(.*)$/', ), 'redirectForNonSupport'=>array('mobile/nonsupport'), 'denyPcBrowser'=>true, 'denyUnknownIP'=>true, 'redirectForPcBrowser'=>array('pc/index'), ), ), 'accessControl', array( 'application.filters.ktai.CssFilter', 'baseDir'=>Yii::app()->getBasePath().'/../', ), array( 'application.filters.ktai.EmojiFilter', ), ); }
HybridController overwites the render function to alternate view files for each carrier.
css/
mobile/
docomo.css // for CssFilter
protected/
controllers/
NormalController.php
MobileController.php
views/
mobile/
index.php // default view file
docomo/index.php // view file for docomo if it exists
au/index.php
softbank/index.php
normal/
index.php
email/
hoge.php
mobile/
hoge.php // mobile mail template if it exists
if you want to show emoji in your view file, see EX below.
[i:20] // docomo emoji [s:20] // softbank emoji [e:20] // au emoji [*:tel] // DENWA icon for all carrier [*:fine] // HARE icon for all carrier
if you see your site in different carrier, [i:20] will be converted into img tag
This library uses HTML_CSS_Mobile, so you don't need to worry about class attribute for docomo template.
See detail: http://coderepos.org/share/browser/lang/php/HTML_CSS_Mobile/
docomo.css
.hoge {
font-size:x-small;
}
hoge.php(view file)
<div class="hoge">fuga</div>
CssFilter automatically convert your css into style attribute. As a rsult, view file will be like this.
<div class="hoge" style="font-size:x-small">fuga</div>
When you see your site with other browser, CssFilter doesn't work.
Use the mail library if you want to send mail for both pc and mobile.
config/main.php
: : 'mailer' => array( 'class'=>'application.extensions.mailer.EMailer', 'pathViews'=>'application.views.email', 'pathLayouts'=>'application.views.email.layouts', 'lang'=>'japanese', 'internalEnc'=>'UTF-8', 'CharSet'=>'iso-2022-jp', 'Encoding'=>'7bit', 'FromName'=>'', ), : : 'params'=>array( 'mobileDomain'=>array( 1=>'docomo.ne.jp', 'ezweb.ne.jp', 'softbank.ne.jp', 'disney.ne.jp', 't.vodafone.ne.jp', 'd.vodafone.ne.jp', 'h.vodafone.ne.jp', 'c.vodafone.ne.jp', 'k.vodafone.ne.jp', 'r.vodafone.ne.jp', 'n.vodafone.ne.jp', 's.vodafone.ne.jp', 'q.vodafone.ne.jp', ), ),
Yii::app()->mailer->From=xxxxxx@softbank.ne.jp; Yii::app()->mailer->AddAddress(xxxxx@softbank.ne.jp); Yii::app()->mailer->Subject='日本語OK'; Yii::app()->mailer->getView('hoge')) Yii::app()->mailer->Send();
In this case, if the email address contains a domain which is listed in the main.php, this mailer will use mobile template (views/email/mobile/hoge.php). If it doesn't exist, view/email/hoge.php will be used instead.
input tag is chaotic because each carrier has their own format, but CMhtml class may help you.
echo CMhtml::activeTextField($model, "user", array('size'=>'20','class'=>'sfont'),'alphabet'); // It is almost same as CHtml. I just add one more argument. // 4th argument should be // * hiragana // * hankakukana // * alphabet // * numeric
uid=NULLGWDOCOMO and guid=on.
Be the first person to leave a comment
Please login to leave your comment.