Skip to content

Instantly share code, notes, and snippets.

@pietvanzoen
Created July 9, 2013 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pietvanzoen/5961047 to your computer and use it in GitHub Desktop.
Save pietvanzoen/5961047 to your computer and use it in GitHub Desktop.
Get_excerpt_stripped :: Record model method for Fuelcms modules to look for record excerpt, strip tags and set character. If no excerpt is found record content is used instead. #fuel
<?php
function get_excerpt_stripped($char_limit = NULL)
{
$this->_CI->load->helper('text');
$excerpt = (empty($this->excerpt)) ? $this->content : $this->excerpt;
// must strip tags to get accruate character count
$excerpt = strip_tags($excerpt);
if (!empty($char_limit))
{
$excerpt = character_limiter($excerpt, $char_limit);
}
return $excerpt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment