'); $string = strip_tags($string, '

'); $words = explode(' ', $string); if (count($words) > $length) { return implode(' ', array_slice($words, 0, $length)) . $ellipsis; } else { return $string.$ellipsis; } } } //Get the navigation bar function hooskNav($slug, $leadingPath = '', $segmentIdx = 0) { $navHtml = ''; $CI =& get_instance(); $CI->db->where('navSlug', $slug); $query=$CI->db->get('cm_navigation'); foreach ($query->result_array() as $n): $totSegments = $CI->uri->total_segments(); if (!is_numeric($CI->uri->segment($totSegments))) { $current = "/".$CI->uri->segment($totSegments-(strpos($CI->uri->segment($totSegments), 'page-') === false ? 0:1)); } elseif (is_numeric($CI->uri->segment($totSegments))) { $current = "/".$CI->uri->segment($totSegments-1); } if ($current == "/") { $current = BASE_URL; }; if($segmentIdx) $current = '/'.$CI->uri->segment($segmentIdx); $current = $leadingPath. $current; $navHtml .= str_replace('

  • ', '
  • ', $n['navHTML']); endforeach; return $navHtml; } function getLastUriSegment() { return get_instance()->uri->segment(get_instance()->uri->total_segments()); } function getFeedPosts() { $CI =& get_instance(); $CI->db->order_by("unixStamp", "desc"); $CI->db->where('published', 1); $query=$CI->db->get('cm_post'); return $query->result_array(); } //Get the Latest 5 news posts function getLatestNewsSidebar() { $CI =& get_instance(); $CI->db->order_by("unixStamp", "desc"); $CI->db->where('published', 1); $CI->db->limit(5, 0); $query=$CI->db->get('cm_post'); $posts = '"; echo $posts; } //Get the Latest news for the main column function getLatestNews($limit=10, $offset=0) { $CI =& get_instance(); $CI->db->order_by("unixStamp", "desc"); $CI->db->where('published', 1); $CI->db->limit($limit, $offset); $query=$CI->db->get('cm_post'); $posts = ''; foreach ($query->result_array() as $c): $date = new DateTime($c['datePosted']); $posts .= '
    '; if ($c['postImage'] != "") { $posts .= '
    '.$c['postTitle'].'
    '; $posts .= '

    '.$c['postTitle'].'

    '; $posts .= '

    '.date_format($date, 'd/m/Y').'

    '; $posts .= '

    '.$c['postExcerpt'].'

    '; $posts .= '

    Read More

    '; } else { $posts .= '

    '.$c['postTitle'].'

    '; $posts .= '

    '.date_format($date, 'd/m/Y').'

    '; $posts .= '

    '.$c['postExcerpt'].'

    '; $posts .= '

    Read More

    '; } $posts .= '
    '; $posts .= "

    "; endforeach; echo $posts; } //Get the categories function getCategories() { $CI =& get_instance(); $CI->db->order_by("categoryTitle", "asc"); $query=$CI->db->get('cm_post_category'); $categories = '"; echo $categories; } //Get the total posts function countPosts($limit=10, $offset=0) { $CI =& get_instance(); $CI->db->from('cm_post'); $CI->db->where('published', 1); $query = $CI->db->get(); $totPosts = $query->num_rows(); $showing = $offset+$limit; if ($showing > $totPosts) { $showing = $totPosts; } $offset++; echo "Showing posts ".$offset." - ".$showing." of ".$totPosts; } function countCategoryPosts($categoryID, $limit=10, $offset=0) { $CI =& get_instance(); $CI->db->from('cm_post'); $CI->db->where('categoryID', $categoryID); $CI->db->where('published', 1); $query = $CI->db->get(); $totPosts = $query->num_rows(); $showing = $offset+$limit; if ($showing > $totPosts) { $showing = $totPosts; } $offset++; echo "Showing posts ".$offset." - ".$showing." of ".$totPosts; } function getPrevBtnCategory($categoryID, $limit=10, $offset=0) { $CI =& get_instance(); $totSegments = $CI->uri->total_segments(); $i=1; $pagURL = ""; while ($i <= $totSegments) { if (!is_numeric($CI->uri->segment($i))) { $pagURL .= "/".$CI->uri->segment($i); } $i++; } $CI->db->from('cm_post'); $CI->db->where('categoryID', $categoryID); $CI->db->where('published', 1); $query = $CI->db->get(); $totPosts = $query->num_rows(); $showing = $offset+$limit; if ($showing > $totPosts) { $showing = $totPosts; } $prevNum = $offset-$limit; if ($prevNum < 0) { $prevNum = 0; } if ($prevNum < $offset) { echo 'Previous'; } } function getNextBtnCategory($categoryID, $limit=10, $offset=0) { $CI =& get_instance(); $totSegments = $CI->uri->total_segments(); $i=1; $pagURL = ""; while ($i <= $totSegments) { if (!is_numeric($CI->uri->segment($i))) { $pagURL .= "/".$CI->uri->segment($i); } $i++; } $CI->db->from('cm_post'); $CI->db->where('published', 1); $CI->db->where('categoryID', $categoryID); $query = $CI->db->get(); $totPosts = $query->num_rows(); $showing = $offset+$limit; if ($showing > $totPosts) { $showing = $totPosts; } $offset++; $nextNum = $offset+$limit; if ($nextNum > $totPosts) { } elseif ($nextNum <= $totPosts) { $nextNum--; echo 'Next'; } } function getPrevBtn($limit=10, $offset=0) { $CI =& get_instance(); $totSegments = $CI->uri->total_segments(); $i=1; $pagURL = ""; while ($i <= $totSegments) { if (!is_numeric($CI->uri->segment($i))) { $pagURL .= "/".$CI->uri->segment($i); } $i++; } $CI->db->where('published', 1); $CI->db->from('cm_post'); $query = $CI->db->get(); $totPosts = $query->num_rows(); $showing = $offset+$limit; if ($showing > $totPosts) { $showing = $totPosts; } $prevNum = $offset-$limit; if ($prevNum < 0) { $prevNum = 0; } if ($prevNum < $offset) { echo 'Previous'; } } function getNextBtn($limit=10, $offset=0) { $CI =& get_instance(); $totSegments = $CI->uri->total_segments(); $i=1; $pagURL = ""; while ($i <= $totSegments) { if (!is_numeric($CI->uri->segment($i))) { $pagURL .= "/".$CI->uri->segment($i); } $i++; } $CI->db->where('published', 1); $CI->db->from('cm_post'); $query = $CI->db->get(); $totPosts = $query->num_rows(); $showing = $offset+$limit; if ($showing > $totPosts) { $showing = $totPosts; } $offset++; $nextNum = $offset+$limit; if ($nextNum > $totPosts) { } elseif ($nextNum <= $totPosts) { $nextNum--; echo 'Next'; } } //Get the Latest news for the main column function getCategoryNews($categoryID, $limit=10, $offset=0) { $CI =& get_instance(); $CI->db->order_by("unixStamp", "desc"); $CI->db->limit($limit, $offset); $CI->db->where('categoryID', $categoryID); $CI->db->where('published', 1); $query=$CI->db->get('cm_post'); $posts = ''; foreach ($query->result_array() as $c): $date = new DateTime($c['datePosted']); $posts .= '
    '; if ($c['postImage'] != "") { $posts .= '
    '.$c['postTitle'].'
    '; $posts .= '

    '.$c['postTitle'].'

    '; $posts .= '

    '.date_format($date, 'd/m/Y').'

    '; $posts .= '

    '.$c['postExcerpt'].'

    '; $posts .= '

    Read More

    '; } else { $posts .= '

    '.$c['postTitle'].'

    '; $posts .= '

    '.date_format($date, 'd/m/Y').'

    '; $posts .= '

    '.$c['postExcerpt'].'

    '; $posts .= '

    Read More

    '; } $posts .= '
    '; $posts .= "

    "; endforeach; echo $posts; } //Get the carousel function getCarousel($id) { $CI =& get_instance(); $CI->db->order_by("slideOrder", "asc"); $CI->db->where("pageID", $id); $query=$CI->db->get('cm_banner'); $carousel = '"."\r\n"; echo $carousel; } //Get social function getSocial() { $CI =& get_instance(); $CI->db->where("socialEnabled", 1); $query=$CI->db->get('cm_social'); $social = ''; foreach ($query->result_array() as $c): $social .= ''; endforeach; echo $social; }