load->library('image_lib'); //$this->load->helper('url'); $this->load->model('CXForum'); } function index($offset=null) { //Fetch all forums (sort by category) if(!$forums = $this->CXForum->fetch_forums()) { show_404(); } //var_dump($forums); //Render the posts $this->load->view('forums/forums', array('forums' => $forums)); } function forum($forum_id=null, $page=0) { /* $data = array( 'parent_id' => null, 'user_id' => 1, 'status' => 1, 'order_by' => 'date desc', 'limit' => 10, 'offset' => 0, 'like' => array(), 'count' => true ); */ if(!$forum_id || !ctype_digit($forum_id)) { show_404(); } //Fetch all topics for the forum (sort by date) $topics = $this->CXForum->fetch_topics(array( 'parent_id' => $forum_id, 'offset' => $page) ); if(!$topics) { show_404(); } //var_dump($forums); //Render the posts $this->load->view('forums/topics', array('topics' => $topics, 'forum_id' => $forum_id)); } function topic($forum_id=null, $topic_id=null, $page=0) { /* $data = array( 'parent_id' => null, 'user_id' => 1, 'status' => 1, 'order_by' => 'date desc', 'limit' => 10, 'offset' => 0, 'like' => array(), 'count' => true ); */ if(!$topic_id || !ctype_digit($topic_id) || !$forum_id || !ctype_digit($forum_id)) { show_404(); } //Fetch all topics for the forum (sort by date) $posts = $this->CXForum->fetch_posts(array( 'parent_id' => $topic_id, 'offset' => $page) ); //If none were found if(!$posts) { show_404(); } //var_dump($forums); //Render the posts $this->load->view('forums/posts', array( 'posts' => $posts, 'topic_id' => $topic_id, 'forum_id' => $forum_id) ); } function test() { print '
';
		
		//Fetch all forums (sort by category)
		print_r($this->CXForum->fetch_forums());
		
		$data = array(
			'parent_id'	=> null,
			'user_id'	=> 1,
			'status'	=> 1,
			'order_by'	=> 'date desc',
			'limit'		=> 10,
			'offset'	=> 0,
			'like'		=> array(),
			'count'		=> true
		);
		
		//Count all topics/posts (sort by forum, user, status, LIMIT, OFFSET, count)
		var_dump($this->CXForum->fetch_topics($data));
		var_dump($this->CXForum->fetch_posts($data));
		
		print "\n\n\n
"; //Fetch all topics/posts (sort by forum, user, status, LIMIT, OFFSET, count) var_dump($this->CXForum->fetch_topics()); var_dump($this->CXForum->fetch_posts()); print '
'; /* //For each post - place it in a template foreach($rows as $row) { $data['posts'][] = $this->load->view('posts/teaser', array('row' => $row), true); } //Render the posts $this->load->view('posts/layout', $data); */ } } /* End of file welcome.php */ /* Location: ./system/application/controllers/welcome.php */