Esempio n. 1
0
 public function page($name = '')
 {
     $page = new Content_Page();
     $page->load_where(array('name' => $name . '_menucontent'));
     if (!$page->body) {
         $page->load_where(array('name' => $name . '_content'));
     }
     if (!$page->body) {
         show_404();
     } else {
         $this->load->view('home', array('page' => $page->body));
     }
     $this->load->view('footer');
 }
Esempio n. 2
0
 public function __construct()
 {
     parent::__construct();
     date_default_timezone_set('America/Los_Angeles');
     $this->load->library('session');
     $tables = $this->db->list_tables();
     if (count($tables) != BLOGSITE_NUM_TABLES && $this->uri->uri_string() != 'home/install') {
         redirect('home/install');
     }
     if ($this->uri->uri_string() != 'home/install') {
         $this->load->model('Content_Page');
         $header_title = new Content_Page();
         $header_title->load_where(array('name' => 'header_title'));
         $header_name = new Content_Page();
         $header_name->load_where(array('name' => 'header_name'));
         if (strpos($this->uri->uri_string(), 'admin') === false) {
             $social_links = $this->Content_Page->get_like(array('name' => '_link'));
             $header_email = new Content_page();
             $header_email->load_where(array('name' => 'header_email'));
             $header_about = new Content_Page();
             $header_about->load_where(array('name' => 'header_about'));
             $content_pages = $this->Content_Page->get_like(array('name' => '_menucontent'));
             $this->load->view('header', array('header_title' => $header_title->body, 'header_name' => $header_name->body, 'social_links' => $social_links, 'header_email' => $header_email->body, 'header_about' => $header_about->body, 'content_pages' => $content_pages));
         } else {
             $admin_about = new Content_Page();
             $admin_about->load_where(array('name' => 'admin_about'));
             $this->load->view('admin/header', array('header_title' => $header_title->body, 'header_name' => $header_name->body, 'admin_about' => $admin_about->body));
         }
     } else {
         $this->load->view('header', array('header_name' => 'BlogSite Install'));
     }
 }
Esempio n. 3
0
 public function archive($page = 0)
 {
     $this->load->model('Content_Page');
     $top = new Content_Page();
     $top->load_where(array('name' => 'blog_main'));
     $total = $this->db->count_all('blog_posts');
     $total_pages = ceil($total / BLOG_POSTS_PER_PAGE);
     $offset = $page * BLOG_POSTS_PER_PAGE;
     $blogs = $this->Blog_Post->get(BLOG_POSTS_PER_PAGE, $offset, "desc");
     $this->load->view('blog/view', array('top' => $top->body, 'blogs' => $blogs, 'page' => $page, 'total' => $total, 'total_pages' => $total_pages));
     $this->load->view('footer');
 }