Power of Love | 愛の告白
CakePHP + Twitter API
@mon_sat
and my app developed in 20 hours
Self Introduction
-
Company
- Direct Search Japan Inc.
-
My Name
- TANANA Kohji
Twitter and blogs
- Twitter http://twitter.com/mon_sat Follow me Now!
- Blog『半年前の私への教科書』 http://text.tklabo.net/blog/
About this application
Twitter is great.
- We can tweet anytime.
- But. If you tweet by this app, you cannot tweet as you like.
- For example.
- If you tweet with 1 YEAR's Power of love by this app, you cannot tweet until a year later.
- So you must tweet with true love.
Access my app now!
- http://love.tklabo.net/
- See the demo.
Notes.
This app is using them.
-
CakePHP 1.3.4
http://cakephp.org/
-
OAuth consumer component
http://code.42dh.com/oauth/
-
Cake Plus Plugin for i18n validation
http://github.com/ichikaway/cakeplus
-
Bit.ly Class
http://planetcakephp.org/aggregator/items/2649-new-bitly-class-to-use-with-cakephp-or-by-it-self
One more thing
HTML5
# view
echo $this->Form->input('post',
aa('placeholder', __("ex) I Love @mon_sat", true),
'required',"required"));
# output
<textarea name="data[Post][post]"
placeholder="例) I Love @mon_sat" required="required"
cols="30" rows="6" id="PostPost">
CSS3
CSS3
# css
@-webkit-keyframes aMessage {
0% {opacity:0.0;}
100%{opacity:1.0;}
}
@-webkit-keyframes aHopping {
0% {bottom: 0;}
70% {bottom: 0;}
85% {bottom: 6px;}
100%{bottom: 0;}
}
.hopping {
position:relative;bottom:0;
-webkit-animation-name: aHopping; /* defined animation name*/
-webkit-animation-duration: 4s; /* duration */
-webkit-animation-timing-function: ease-out; /* type of animations */
-webkit-animation-iteration-count: infinite; /* loop */
}
We love ...
My app is developed
about 20 hours.
I ♥ PHP Frameworks.
Thanks. by @mon_sat
.
Ktai Library で振り分ける
- beforeRenderで振り分ける
# controller
class UsersController extends AppController {
var $view = "Theme";
function beforeRender() {
if ($this->Ktai->is_ktai()) {
$this->theme = "ktai";
} else {
$this->theme = "pc";
}
}
}
- こうすると同じURLでPC用とケータイ用のふたつのviewを用意できます。
でも注意点が。その1
同じURLでPC・ケータイ共通にするとSEO的に良くないことがあるかも
-
Google先生をはじめ検索エンジンのクローラーはケータイのUserAgentを偽装しているはずですが
- 今後仕様が変わらないとはいえないこともない
- PCサイトもケータイサイトも同じUAのクローラーもあるかもね
- Ktai Library側でIPアドレスによるis_ktai()判定をができるようになったときに注意
でも注意点が。その2
DebugKitを使う場合
- Themeを使っているとDebugKitのToolbarが表示されない!?
- DebugKit.ToolbarConponet::startup()で、$controller->viewを取得している
- そのため以下のコードではNG
# controller
class UsersController extends AppController {
$components = array("DebugKit.Toolbar");
function beforeRender() {
$this->view = "Theme";
$this->theme = "ktai";
}
}
DebugKitを使う場合は、
beforeFilterまでに指定する
# controller
class UsersController extends AppController {
$components = array("DebugKit.Toolbar");
function beforeFilter() {
$this->view = "Theme";
$this->theme = "ktai";
}
}
- これならOK
- 最悪 function __construct() {} で指定