// Session based API call. if ($session) { $uid = $facebook->getUser(); $me = $facebook->api('/me'); } // login or logout url will be needed depending on current user state. $loginUrl = $logoutUrl = null; if ($me) { $logoutUrl = $facebook->getLogoutUrl(); } else { $loginUrl = $facebook->getLoginUrl(); } // This call will always work since we are fetching public data. $naitik = $facebook->api('/naitik'); $appId = $facebook->getAppId(); $encodedSession = json_encode($session); $this->set(compact('loginUrl', 'logoutUrl', 'appId', 'encodedSession', 'me', 'uid', 'naitik')); } /** * 出力 * * @return void */ public function onOutput() { $this->display(); } } $options = array('cache' => array('type' => 'init', 'life' => 10)); App_Main::run('Page_Canvas_Index', $options);
<?php /** * Main index PHP file * * @package Core * @category PHP * @copyright Copyright (c) 2010 Hettema&Bergsten * @author */ include_once "app/main.php"; App_Main::run();
/** * Inject * * @return void */ public function onInject() { } /** * Init * * @param array $args * * @return void */ public function onInit(array $args) { $this->set('greeting', 'hello world'); } /** * Output * * @return void */ public function onOutput() { $this->display('helloWorld.tpl'); } } App_Main::run('Page_HelloWorld');
public function onInject() { parent::onInject(); } /** * 初期化 * * @return void */ public function onInit(array $args) { // RSS resource $uri = 'http://rss.excite.co.jp/rss/excite/odd'; $options['pager'] = 5; $params = array('uri' => $uri, 'values' => array(), 'options' => $options); $this->_resource->read($params)->set('news'); $this->set('time', date('n/j H:i')); } /** * 出力 * * @return void */ public function onOutput() { $this->display(); } } $options = array('cache' => array('type' => 'init', 'life' => 10)); App_Main::run('Page_Index', $options);