function _view($page_name) { // this is only used internally $page = $this->Page->get_by_name($page_name); if (!$page) { return $this->_form("Unknown page: {$page_name}"); } $feed = $this->Feed->get($page->feed_id); $feed_url = $feed->feed_url; // allow dynamic feed URLs if ($feed->id == 0) { if ($feed_url = $this->input->post('ext_feed_url')) { set_cookie(array('name' => 'ext_feed_url', 'value' => $feed_url, 'expire' => $this->config->item('cookie_lifetime'))); } elseif (!($feed_url = $this->input->cookie('ext_feed_url'))) { $feed_url = 'http://feedvolley.com/recent'; } } $html = $this->Page->get_html($page->id); $rss = $this->Feed->load($feed_url); $this->load->library('Tparser'); $this->load->library('ThemeParser'); $this->load->helper('edit_bar'); $output = $this->themeparser->render($rss, $html, $page->title); // insert edit/duplicate bar $output = preg_replace('/(<body.*?>)/msi', '$1 ' . edit_bar($page, $this->User->has_code($page->admin_code)), $output); $output = preg_replace('/(<\\/body.*?>)/msi', google_analytics() . '$1', $output); // if local request --- this is currently pointless until a better is_local() is created if (is_local() && stripos($output, '<body>') === false) { $output = edit_bar($page, $this->User->has_code($page->admin_code)) . $output; } // echo $output; // using a view, to enable caching $data['content'] = $output; $this->load->view('pages/render_page', $data); if (!$this->User->has_code($page->admin_code)) { $this->output->cache(3); } }
<?php $this->load->helper("google"); echo google_analytics(); ?> </body> </html>