/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     // create new sitemap object
     $sitemap = App::make("sitemap");
     $today = '2014-11-01T12:30:00+02:00';
     // set cache (key (string), duration in minutes (Carbon|Datetime|int), turn on/off (boolean))
     // by default cache is disabled
     //    $sitemap->setCache('laravel.sitemap', 1);
     // add item to the sitemap (url, date, priority, freq)
     $sitemap->add(URL::to('/'), $today, '1.0', 'daily');
     $sitemap->add(URL::to('about'), $today, '0.8', 'monthly');
     $sitemap->add(URL::to('category/all'), $today, '0.8', 'monthly');
     $sitemap->add(URL::to('category/web'), $today, '0.8', 'monthly');
     $sitemap->add(URL::to('category/olm'), $today, '0.8', 'weekly');
     $sitemap->add(URL::to('category/games'), $today, '0.8', 'weekly');
     $data = Category::get_items('all', true);
     $entries = $data['json']['entries'];
     foreach ($entries as $item) {
         $o = (array) $item['entry'];
         $client_key = $o['client_key'];
         $entry_key = $o['entry_key'];
         $to = "item/" . $client_key . "/" . $entry_key;
         $sitemap->add(URL::to($to), $today, '0.9', 'weekly');
     }
     // show your sitemap (options: 'xml' (default), 'html', 'txt', 'ror-rss', 'ror-rdf')
     $sitemap->store('xml', 'sitemap');
     return $sitemap->render('xml');
 }
Example #2
0
 /** 
  * Lists subcategories and items contained in the category.
  */
 public function show_category()
 {
     $category_id = $this->get_arg('id', 0);
     $category = new Category($category_id);
     $data['categories'] = $category->get_child_categories();
     $data['items'] = $category->get_items();
     $data['breadcrumbs'] = $this->generate_breadcrumbs($category_id);
     $data['category_id'] = $category_id;
     return new View('category', $data);
 }