Example #1
0
 protected function renderGalleryItemPage($post, $params)
 {
     $view_data = array();
     // get gallery item
     $model = new Gallery();
     $active_item = $model->get_item_by_id($params[0]);
     // next / prev
     $post->next = $post->galleries[0]->items->filter(function ($item) use($active_item) {
         return $item->id > $active_item->id;
     })->first();
     $post->prev = $post->galleries[0]->items->filter(function ($item) use($active_item) {
         return $item->id < $active_item->id;
     })->first();
     $add_data = array('pageParams' => $params, 'active_item' => $active_item);
     // --------------------------------------
     $meta_data = $this->setMetaData($post);
     $view_data = array_merge($view_data, $meta_data);
     // navigation
     // --------------------------------------
     $view_data['navigation'] = $this->renderNavigation();
     // --------------------------------------
     $template_data = $this->setPageData($post, $add_data);
     // page template (handlebars)
     $content = View::make('hbs::photo', $template_data);
     $view_data['content'] = $content;
     return View::make('layouts.application', $view_data);
 }