function index() { $domains = get_domains(); header('Content-type: text/xml'); echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc><?php echo site_url(); ?> </loc><priority>1</priority></url><?php //foreach domain foreach ($domains as $domain) { //if not a separator if ($domain['type'] != 'separator') { //get files $files = get_files($domain['webname']); foreach ($files as $file) { //get rid off extension $file = str_replace("." . $domain['type'], "", $file); //extract segments $date = extract_feed_date($file, $domain['webname']); //make url $url = site_url($domain['webname'] . '/' . $date['y'] . '/' . $date['m'] . '/' . $date['d']); //display URL tag echo '<url><loc>' . $url . '</loc></url>'; } } } echo "</urlset>"; }
function index($site = '', $y = '', $m = '', $d = '', $item_number = 0) { $data['domains'] = get_domains(); $data['y'] = check_year($y); $data['m'] = check_month($m); $data['d'] = check_day($d); $data['site'] = check_site($site, $data['domains']); $data['item_number'] = $item_number; $current_date = array('y' => $data['y'], 'm' => $data['m'], 'd' => $data['d']); $doThis = whatToDo($data['y'], $data['m'], $data['d'], $data['site']); $data['doThis'] = $doThis; switch ($doThis) { case "day": //previous $previous_feed_date = extract_feed_date($this->_get_previous_feed($data['domains'], $data['site'], $current_date), $data['site']); $data['yesterday'] = $data['site'] . '/' . $previous_feed_date['y'] . '/' . $previous_feed_date['m'] . '/' . $previous_feed_date['d']; //current $data['feedUrl'] = "feeds/" . $data['site'] . "/" . $data['site'] . $data['y'] . $data['m'] . $data['d'] . "." . $data['domains'][$data['site']]['type']; //view if (file_exists($data['feedUrl'])) { $data['title'] = 'Popular links on ' . $data['domains'][$data['site']]['name'] . ' ' . $data['y'] . '/' . $data['m'] . '/' . $data['d'] . ' | rrrewind'; $data['view'] = 'view_show'; $data['items'] = $this->get_items($data['domains'], $data['site'], $data['feedUrl']); } else { //the file DONT exist $data['view'] = 'view_archives'; } break; case "recent": //current $recent_feed = get_recent_feed($data['site']); $data['feedUrl'] = "feeds/" . $data['site'] . "/" . $recent_feed; //previous $current_date = extract_feed_date($recent_feed, $data['site']); $previous_feed_date = extract_feed_date($this->_get_previous_feed($data['domains'], $data['site'], $current_date), $data['site']); $data['yesterday'] = $data['site'] . '/' . $previous_feed_date['y'] . '/' . $previous_feed_date['m'] . '/' . $previous_feed_date['d']; $data['y'] = $current_date['y']; $data['m'] = $current_date['m']; $data['d'] = $current_date['d']; $data['title'] = 'Popular links on ' . $data['domains'][$data['site']]['name'] . ' ' . $data['y'] . '/' . $data['m'] . '/' . $data['d'] . ' | rrrewind'; $data['items'] = $this->get_items($data['domains'], $data['site'], $data['feedUrl']); //view $data['view'] = 'view_show'; break; case "error": $data['view'] = 'view_error'; break; } $this->load->view('template', $data); }
<div id="content_wrap"> <div id="content" class="archives_links"> <h1>Archives / <?php echo $domains[$site]["name"]; ?> </h1> <?php $feednames = get_files($site); $site_lenght = strlen($site); if ($feednames) { foreach ($feednames as $feedname) { $string = substr($feedname, $site_lenght, 8); $feed_date = extract_feed_date($feedname, $site); ?> <a class="archives_link" href="<?php echo site_url($site . '/' . $feed_date['y'] . '/' . $feed_date['m'] . '/' . $feed_date['d']); ?> "><?php echo $string; ?> </a><br><?php } } ?> </div><!-- end content --> </div><!-- end content_wrap --> </div><!-- end wrap -->