本文整理汇总了PHP中APP::loadView方法的典型用法代码示例。如果您正苦于以下问题:PHP APP::loadView方法的具体用法?PHP APP::loadView怎么用?PHP APP::loadView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APP
的用法示例。
在下文中一共展示了APP::loadView方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: about
function about($params, $renderLayout = true)
{
//instantiate db
$db = new Database();
//put together call
$find = array('table' => 'content', 'select' => 'all');
//return data array
$content = $db->find($find);
$pass = array('title_for_page' => 'About', 'data' => $content);
$path = $this->controller . DS . 'about';
parent::loadView($path, $pass);
}
示例2: index
function index($params, $renderLayout = true)
{
//set twitter rss path and load xml
$path = "https://twitter.com/statuses/user_timeline/17672775.rss";
$twitter_feed = simplexml_load_file($path);
//Loop through xml and pass data array to view
$count = 0;
$display = array();
foreach ($twitter_feed->channel->item as $tweet) {
if ($count > 7) {
break;
}
$display[$count]['title'] = (string) $tweet->title;
$display[$count]['date'] = date('M d,Y', strtotime((string) $tweet->pubDate));
$display[$count]['link'] = (string) $tweet->link;
$count++;
}
$pass = array('feed' => $display);
$path = $this->controller . DS . 'index';
return parent::loadView($path, $pass, $renderLayout);
}
示例3: index
function index($params, $renderLayout = true)
{
//set per page request to whats passed in or default to 50
$per_page = isset($params[0]) ? $params[0] : 50;
//set size to whats passed in or square
$size = isset($params[1]) ? $params[1] : 's';
//Create flickr path and load xml
$path = sprintf("http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=%s&tags=autolux&per_page=%s", $this->api_key, $per_page);
$flickr_feed = simplexml_load_file($path);
//Loop through flickr feed and build url to pass to view
$count = 0;
$display = array();
foreach ($flickr_feed->photos->photo as $photo) {
$display[$count]['link'] = (string) 'http://flickr.com/photos/' . $photo[@owner] . '/' . $photo[@id];
$display[$count]['photo'] = (string) "http://farm" . $photo[@farm] . ".static.flickr.com/" . $photo[@server] . "/" . $photo[@id] . "_" . $photo[@secret] . "_{$size}.jpg";
$count++;
}
//pass the photos array to the page
$pass = array('photos' => $display, 'title_for_page' => 'Photos');
$path = $this->controller . DS . 'index';
return parent::loadView($path, $pass, $renderLayout);
}
示例4: index
function index($params, $renderLayout = true)
{
//instantiate eventful class
$this->Eventful = new Eventful();
//create options for eventful call
$eventful_opts = array('section' => 'performers', 'method' => 'get', 'options' => array('id' => 'P0-001-000014425-1', 'show_events' => 'true'));
//Find events and pass back xml
$events = $this->Eventful->find($eventful_opts);
//Loop through XML and create events array
$events = $events->events->children();
$count = 0;
foreach ($events->event as $event) {
$display[$count]['link'] = (string) $event->url;
$display[$count]['title'] = (string) $event->title;
$display[$count]['date'] = date('M d,Y', strtotime((string) $event->start_time));
$display[$count]['location'] = (string) $event->location;
$count++;
}
//Pass events to view
$pass = array('events' => $display, 'title_for_page' => 'Shows');
$path = $this->controller . DS . 'index';
return parent::loadView($path, $pass, $renderLayout);
}