Here’s what I came up with:
function Word_limit($str = '')
{
$this->EE =& get_instance();
$total = ( ! $this->EE->TMPL->fetch_param('total')) ? 500 : $this->EE->TMPL->fetch_param('total');
$total = ( ! is_numeric($total)) ? 500 : $total;
// This fetchs a 2nd parameter from the tag.
// Used in the link below.
$title = $this->EE->TMPL->fetch_param('title');
$str = ($str == '') ? $this->EE->TMPL->tagdata : $str;
$my_returned_str = $this->EE->functions->word_limiter($str, $total);
if ($my_returned_str > $str)
{
$this->return_data = $my_returned_str . "<span><a >[ read more ]</a></span>";
} else {
$this->return_data = $my_returned_str;
}
}I added a 2nd parameter (‘title’) which passes the {url_title} to the $title var.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.