h2ospace

CakePHP + jQueryã?§ mixiã?¢ã??ã?ªã??ä??ã?£ã?¦ã?¿ã??

2009-12-16 02:21:57

å§?ã??ã??å??ã??ã??ã??ã??ã??ã??ã??ç??é??ã??ã??ã??ã??ã??説æ??ä??ã??è¶?ã??é??ã??ã?§ã??ã?? mixiã?¢ã??ã?ªã?§ã??ã??ã??ç??å±?å¿?ã??ã??ã??ã??ã??ã??ã?¦ã??ã?¡ã??ã?¨å??å??ã??ã??ã?¦ã??ã??ã??ã??ã?§ã??ã??ã??ã??

ã?ªã??ã??ã??ã??ã??ã?§ã??ã??ã?ªã??ç??ã??ä¸?ã??ã?£ã?¦ã??ã?¦è?¯ã??æ??ã??ã?§ã??ã??ã??ã?¨ã??ã??ã??ã?¨ã?§ã??é??ã??ã?°ã??ã?ªã??ã??ç§?ã??å??æ?¦ã??æ??è§?ã?ªã?®ã?§ã??è¦?ã??ã??ã?¦ã?® CakePHPã?¨ã??大å??ã??ã?ª jQueryã?§ä??ã??ã??ã?¨ã??å?ºã??ã?ªã??ã??ã??模ç´¢ã??ã?¦ã?¿ã??ã??ã??ã??ä??ä¸?ã?¡ã?¢ã?§ã??ã??

ã??ã??ã?¯å??å?°ä??ã??

ã??ã??ã?¯ã??mixi Developer Centerã??è¦?ã?ªã??ã??ã??ã??ã??ã??ã??ç??é??ã?ªã?©ã??æ¸?ã??ã??ã?¦é??ç?ºç?°å¢?ã??æ??ã??å??ã??ã??ã??ã??

ã??ã??ã??mixiã?¢ã??ã?ªã?®æ?¬ä??è?ªä??ã?¯ã??è?ªå??ã?§æº?å??ã??ã??ã??ã??ã??ã??ä¸?ã?§å??ä??ã??ã??ã??ã??ã??ã??ã??æº?å??ã??ã??ã??ã??
ã??ã??ã??ã??ã??é?©å??ã?ªã??ã?©ã??ã??ã?ªã?©ã??次ã?®ã??ã??ã?ª XMLã??ã??index.xmlã??ã?ªã?©ã?®å??å??ã?§ä¿?å??ã??ã??ã??ã??

<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="My mixi appli">
<Require feature="opensocial-0.8" />
</ModulePrefs>
<Content type="html"><![CDATA[

<p>mixiã?¢ã??ã?ª</p>

]]></Content>
</Module>

è©?ã??ã??å??å®?ã?¯ã??ã??ã?§ã?¯ç??ç??ã??gihyo.jpã?®è¨?äº?ã?ªã?©ã??è©?ã??ã??ã?§ã??ã??

ã??ã??ã??ã??ã??ã??ã?® XMLã??ã?¡ã?¤ã??ã?¸ã?®ã??ã??ã??ã??ã??æ??ã?£ã?¦ã??mixiã?¢ã??ã?ªã?®ç??é??ç??é?¢ã?§ç??é??ã??ã?¦ã??ã??ã??ã??ã??è©?ã??ã??å??å®?ã?¯ã??ã??ã?®ã?¸ã??ã?§ã??

ã??ã??ã?§ã??ã??ã??ã?¯ OKã??mixiã?¢ã??ã?ªã??ç??é??ã??ã??ã??ç??é?¢ã??ã??mixiã?¢ã??ã?ªã??ã?¨è¡¨ç¤ºã??ã??ã??ã?¯ã??ã?§ã??ã??

jQueryã??ã?¤ã??ã??

mixiã?¢ã??ã?ªã?¯ã??å?¨ä??ã?? JavaScriptã?? Flashã?§å?¶å?¡ã??ã??ã?®ã?§ã??ã??ã??ã??ã??ã?§ã?¯ jQueryã??ä?¿ã??ã??ã??ã?¨æ??ã??ã??ã??ã??ã??ã??ã??ã??jQueryã?¯æ?®é??ã??ç??ã?¿è??ã??ã??ã?¨ã?¯å?ºæ??ã??ã??ã??ã??ã??ã??ã?§ã??ä?¿å?©ã?ªã?©ã?¤ã??ã?©ã?ªã??å?¬é??ã??ã??ã?¦ã??ã??ã??ã??

ã??ã??ã??ä?¿ã??ã?°ã??mixiã?¢ã??ã?ªä¸?ã?§ jQueryã??å?©ç?¨å?ºæ??ã??ã??ã??ä?¿å?©ï??ã??ã?¨ã??ã??ã??ã?¨ã?§ã??ã??ã??ã??ã??ã??ã??ã?¦ã??ã??ã??ã??ã??ã?¦ã??å??ã?® XMLã?¨å??ã??ã??ã?©ã??ã??ã??ã?¢ã??ã??ã??ã??ã??ã??次ã?®ã??ã??ã??æ?¸ã??å??ã??ã??ã??ã??

...
<Content type="html"><![CDATA[
<script type="text/javascript" src="http://mixiappli.h2o-one.com/sha1/_js/opensocial-jquery.min.js"></script>
...

ã??ã??ã?§ã?®ã??ã?¤ã??ã??ã?¯ã??å¿?ã??ã?©ã?¤ã??ã?©ã?ªã?¸ã?®ã??ã??ã??ã??ã??ã??ã??ï??http://ã??ã??å§?ã??ã??URLï??ã??è¨?è¿°ã??ã??ã??ã?¨ã??mixiã?¢ã??ã?ªã?¯å??ä??ã??ã??ã??ã?¨ã??ã??ã??é??常ã?®ã??ã?®ã?¨ã?¯å¤?ã??ã?£ã?¦ã??ã??ã??ã?®ã?§ã??ã?ªã??ã?¯ã??ã?§ã??ã?ªã??ã?ªã??ã??ã??ã??

å??ã??ã??ã??ã??ã??CSSã??ç°¡å??ã??ã?ªã??ã?¯ã??å?ºæ??ã??ã??ã??ã??ã??ã?§ã?¯ã??Yahoo UI Librariesã?® reset.cssã??ã?ªã??ã?¯ã??ã??ã??ã??ã??

...
<Content type="html"><![CDATA[
<script type="text/javascript" src="http://mixiappli.h2o-one.com/sha1/_js/opensocial-jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css">
...

ã??ã?¨ã?¯ã??ã??ã?¤ã??ã?®ã??ã??ã?? HTMLã?¨ JavaScriptã??è¨?è¿°ã??ã??ã?°ã??jQueryã??å?©ç?¨ã??ã??ã??ã?¨ã??å?ºæ??ã??ã??ã??

...
<Content type="html"><![CDATA[
<script type="text/javascript" src="http://mixiappli.h2o-one.com/sha1/_js/opensocial-jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css">

<p></p>

<script type="text/javascript">
$('p').html('jQueryã??å??ä??ã??ã??ã??ã??ï??');
</script>
...

CakePHPã??ä?¿ã??

ç¶?ã??ã?¦ã??CakePHPã??ä?¿ã??ã??ã??ã??ã??ã??ã??ã??ã?? CakePHPã?¯å??å¿?è??ã?ªã?®ã?§ã??ã??ã??ã??ã??é??常ã??å??ç??ã??æ?ªã??ã?§ã??ã??æ??è?¯ã?§ã??ã??ã??æ??è?¯ã??ã??ã??ã??

ã??ã??ã?¯ã??å??ç¨?ã?®ã??ã?©ã??ã??ã?¨ã?¯å??ã?®ã??ã?©ã??ã??ã??CakePHPã??ã?¤ã??ã??ã??ã??ã??ã??ã??ã??ã??ã??ã??ã??ã?§ã?¯ã??_coreã??ã?¨ã??ã??ã??ã?©ã??ã??ã??ã??ã??ã??ã??ã??
ã??ã??ã?¦ã??ã??ã??ã?¿ã??ã??ã??ã??ä?¿ã??ã?ªã??ã?®ã?§/app/app_model.phpã??ã??次ã?®ã??ã??ã??è¨?è¿°ã??ã??ã??ã??

	var $useTable = false;

ã??ã??ã??ã??jQueryã??ã??å??ã??å?ºã??ã??ã??ã?¨ã??ã?¸ã??ã??ã?ªã??ã??ã??ã??ã??ã??ã??ã??ã??ã??ã??ã?ªã?©ã??å?ºå??ã??ã??ã?ªã??ã??ã??ã??ã??ã??ã??ã??ã??ã??ã?§ã??ã?¬ã?¤ã?¢ã?¦ã??ã??å?©ç?¨ã??ã?ªã??ã??ã??ã??ã??ã??ã??ã??ã??ã??ã??ä??ã??ã?¨ã??ã??ã??次ã?®ã??ã??ã??è¨?è¿°ã??ã??ã??ã??ã??

class Sha1Controller extends AppController {
	var $name = 'Sha1';
	var $layout = false;
...

ã??ã?¨ã?¯ã??ã??ã??ã??ã?§JSONã??è¿?å?´ã??ã??ã??ã??ã??ä??ã?£ã?¦ã??ã??ã??ã??ã??

{'ret': '<?php e($ret); ?>'}

ã??ã??ã?§å®?æ??ï??ã??jQueryå?´ã?§ã??ã??ã?®ã??ã?¯ã?ªã??ã??ã??å??ã??å?ºã??ã??ã??ã??ä??ã??ã??ã??ã?§ã??ã??ã??ã??ã??

$.getJSON('http://mixiappli.h2o-one.com/sha1_core/sha1?svalue=' + sha1.svalue,
function(data) {
...

ã??ã?£ã??ã??ã??ã??ã??é??ã??ã??ã??ã?¤ã??ã??

ã??ã??ã?ªæ??ã??ã?§é??ç?ºã??ã?§ã??ã??ã?®ã?§ã??ã??ã??mixiã?¢ã??ã?ªã??ä??ã?£ã?¦ã??ã??ã?¨å?°ã??ã?®ã??ã??ã??ã?£ã??ã??ã??ã??ã??
mixiã?¢ã??ã?ªã?¯ã??ã??ã?ªã??ã??ã?¡ã?¤ã??ã??ã??ã?£ã??ã??ã??ã??ã??ã??ã??ã?§ã??æ?´æ?°ã??ã?¦ã??æ?´æ?°ã??ã?¦ã??å??æ??ã??ã??ã??ã??ã??ã??

ä¸?å¿?ã??ã?¢ã??ã?ªã?®ç®¡ç??ç??é?¢ã??ã??ã??ã?£ã??ã??ã??ã??ã?¯ã?ªã?¢ã??ã??ã??ã?¨ã??ã??ã?ªã??ã?¯ã?¯ã??ã??ã?®ã?§ã??ã??ã??ã??ã?¡ã??ã?¡ã??ã??ã??æ??ã??ã?®ã?¯ã??ã?ªã??é?¢å??ã??ã??ã??ã??ã?§ã??ã??ã??ã?¤ã??æ??æ??ã??模ç´¢ã??ã?¦ã?¿ã??ã??ã??ã??

ã??ã??ã?¯ã??XMLã??ã?¡ã?¤ã??ã??次ã?®ã??ã??ã??è¨?è¿°ã??ã??ã??ã??

...
<Require feature="opensocial-0.8" />
<Optional feature="content-rewrite">
<Param name="exclude-urls"></Param>
<Param name="exclude-urls">.*</Param>
<Param name="include-tags"></Param>
</Optional>
</ModulePrefs>
<Content type="html"><![CDATA[
...

ã??ã??ã?§ã??ã??ã?£ã??ã??ã??ã??æ¯?å??ç?¡å??ã??ã??ã?¦ã??ã??ã??ã??ã??ã?§ã??ã??Ajaxé??ä¿¡ã?ªã?©ã??ã??ã??ã?¨ã??é??ä¿¡ç??æ??ã??ã??ã?£ã??ã??ã??ã??ã?¡ã??ã??ã??ã??ã?ªã?®ã?§ã??ã??ã??ã?¯å¿?é??ã?®ã??ã??ã?§ã??ã??ï??ã??ã?¡ã??ã??ã??å®?å®?å??ä??ã??ã??ã??ã??ã??å¤?ã??ã?¨è?¯ã??ã??ã??ã?§ã??ï??

ç¶?ã??ã?¦ã??ã?¢ã??ã?ªã??å??ã??å?ºã??ã?¨ã??ã?®URLã??ã??&nocache=1ã??ã??ä??å??ã??ã??ã??ã??ä??ã??ã?°

http://mixi.jp/run_appli.pl?id=99999

ã?¨ã??ã?? URLã?§ã??ã??ã?°

http://mixi.jp/run_appli.pl?id=99999&nocache=1

ã??ã??ã?§ã??HTMLã?®ã??ã?£ã??ã??ã??ã??é??ã??ã??ã?¨ã??ã?§ã??ã??ã??ã??ã?§ã??ã??

ã?¨ã??ã??ã??ã?¨ã?§ã??ã??ã??ã??ã??é??ç?ºã?®ã??ã?¿ã??ã??ã?©ã?¤ã??ã??ç??ã?¦ã??æ??ã??ã?§ã??ã??
ã??ã?¤ã??ã?¯ã?®æ??å?±ã??å??å??ã??ã??ã??ã??æ??å??ã??ã??ã?£ã??ã??ã?§ã??ã??ã??ã??ã?ªã??ã??ã?°ã?©ã??ã??å??ã??ç¶?ã??ä??ã??ã??ã??ã??ã??ã?ªã?£ã?¦ã??ã??ã??ã??ã?¨æ??ã??ã??ã??ã??ã??ã??ã?°ã??ã??ã?£ã?¨ï??

※このエントリは ブロガーにより投稿されたものです。朝日インタラクティブ および ZDNet Japan編集部の見解・意向を示すものではありません。
このサイトでは、利用状況の把握や広告配信などのために、Cookieなどを使用してアクセスデータを取得・利用しています。 これ以降ページを遷移した場合、Cookieなどの設定や使用に同意したことになります。
Cookieなどの設定や使用の詳細、オプトアウトについては詳細をご覧ください。
[ 閉じる ]