示例#1
0
 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);
 }
 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);
 }
 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
0
 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);
 }