function read() { $id = $this->uri->segment(2); $data['post'] = $this->m_posts->get_post_by_type_ref(2, $id); //type_id:2 = blog #if deleted if ($data['post']->deleted == 1) { #redirect to 404 or denied redirect('404'); } $this->m_posts->add_view_count(2, $id); //type_id:2 = blog $data['add_css'] = array('fancybox/jquery.fancybox-1.3.1'); $data['add_js'] = array('fancybox/jquery.fancybox-1.3.1.pack', 'like'); /*$like['has_like'] = $this->m_likes->check_like($this->session->userdata('user_id'),2,$id); $like['post_type'] = 2; $like['id'] = $id; $data['like_bar'] = $this->load->view('includes/like_bar.php',$like,true); */ $data['like_bar'] = build_like($this->session->userdata('user_id'), 2, $id); $data['blog_info'] = $this->m_blogs->read($id, true); $data['account'] = $this->m_accounts->read($data['post']->account_id); $data['photos'] = $this->m_photos->read($data['post']->ID); $data['profile'] = $this->m_profiles->read_by_account_id($data['account']->ID); $data['nb_posts'] = $this->m_posts->count_user_posts($data['account']->ID); $data['nb_days'] = get_total_days($data['profile']->member_since, date("Y-m-d")); $data['other_blogs'] = $this->m_posts->get_user_blogs($data['account']->ID, 'desc', array('limit' => 3)); $data['likes'] = count($this->m_likes->read_arr(array('post_id' => $data['blog_info']->ID, 'post_type' => 2))); //print_r($data['likes']); $data['title'] = $this->title . ' - ' . $data['blog_info']->title . ' by ' . $data['account']->user_name; $data['page_description'] = substr(trim(strip_tags($data['blog_info']->content)), 0, 150); $tags_arr = array(); $tags = $this->m_tags->read($data['post']->ID); foreach ($tags as $r) { $tags_arr[] = $r->name; } #$data['tags'] = implode(', ',$tags_arr); $data['tags'] = $tags_arr; $type_id = 2; // blog include 'includes/comments_list.php'; include 'includes/comment_form.php'; $this->load->view('v_blog', $data); }
function read() { $id = $this->uri->segment(2); $data['post'] = $this->m_posts->get_post_by_type_ref(3, $id); //type_id:3 = project #if deleted if ($data['post']->deleted == 1) { #redirect to 404 or denied #show_error('The content has been removed'); redirect('404'); } $this->m_posts->add_view_count(3, $id); //type_id:3 = project $data['add_css'] = array('fancybox/jquery.fancybox-1.3.1'); $data['add_js'] = array('fancybox/jquery.fancybox-1.3.1.pack', 'like'); $data['like_bar'] = build_like($this->session->userdata('user_id'), 3, $id); $data['project_info'] = $this->m_projects->read($id); $data['account'] = $this->m_accounts->read($data['post']->account_id); $data['photos'] = $this->m_photos->read($data['post']->ID); $data['profile'] = $this->m_profiles->read_by_account_id($data['account']->ID); $data['other_projects'] = $this->m_posts->get_user_projects($data['account']->ID, 'desc', array('limit' => 5)); $data['nb_posts'] = $this->m_posts->count_user_posts($data['account']->ID); $data['nb_days'] = get_total_days($data['profile']->member_since, date("Y-m-d")); $data['likes'] = count($this->m_likes->read_arr(array('post_id' => $data['project_info']->ID, 'post_type' => 3))); #$data['likes'] = count($this->m_likes->read_arr(array($data['post']->ID)); $tags_arr = array(); $tags = $this->m_tags->read($data['post']->ID); foreach ($tags as $r) { $tags_arr[] = $r->name; } #$data['tags'] = implode(', ',$tags_arr); $data['tags'] = $tags_arr; #$data['title'] = $this->title.' - Hunts | '.$data['project_info']->title; $data['title'] = $this->title . ' - ' . $data['project_info']->title . ' by ' . $data['account']->user_name; $data['page_description'] = substr(trim(strip_tags($data['project_info']->content)), 0, 150); $type_id = 3; // project include 'includes/comments_list.php'; include 'includes/comment_form.php'; $this->load->view('v_project', $data); }
function thread() { $id = $this->uri->segment(3); $data['post'] = $this->m_posts->get_post_by_type_ref(5, $id); //type_id:5 = forum #if deleted if ($data['post']->deleted == 1) { #redirect to 404 or denied #show_error('The content has been removed'); redirect('404'); } $this->m_posts->add_view_count(5, $id); //type_id:5 = forum $data['add_css'] = array('fancybox/jquery.fancybox-1.3.1'); $data['add_js'] = array('fancybox/jquery.fancybox-1.3.1.pack', 'like'); $data['like_bar'] = build_like($this->session->userdata('user_id'), 5, $id); $data['thread_info'] = $this->m_threads->get_thread($id); #$data['thread_info'] = $this->m_threads->read($id); $data['forum_info'] = $this->m_forums->read($data['thread_info']->forum_id); $data['account'] = $this->m_accounts->read($data['post']->account_id); $data['profile'] = $this->m_profiles->read_by_account_id($data['account']->ID); $data['title'] = $this->title . " - " . $data['thread_info']->title; $data['nb_posts'] = $this->m_posts->count_user_posts($data['account']->ID); $data['nb_days'] = get_total_days($data['profile']->member_since, date("Y-m-d")); $data['likes'] = count($this->m_likes->read($id)); $tags_arr = array(); $tags = $this->m_tags->read($data['post']->ID); foreach ($tags as $r) { $tags_arr[] = $r->name; } #$data['tags'] = implode(', ',$tags_arr); $data['tags'] = $tags_arr; $type_id = 5; // forum include 'includes/comments_list.php'; include 'includes/comment_form.php'; $this->load->view('v_thread', $data); }