There's a guide here for making your own output filter..
http://kb.x-cart.com/display/XDD/Flexy+Guide
I found this method easier...
create a file called ShortenText.php in your View folder of your theme classes like this...
Code:
<?php
namespace XLite\Module\Customer\CustomerTheme\View;
/**
* Abstract widget
*/
abstract class ShortenText extends \XLite\View\AView implements \XLite\Base\IDecorator
{
protected function flexyModifierShortenText($string)
{
$string = substr($string, 0, strrpos(substr($string, 0, 200), ' '));
return $string."...";
}
}
Then create a copy of the template you want to add the filter to and put it in your template theme folder ie skins/Customer/CustomerTheme/en/modules/XC/News/top_news_messages/list/parts/
I'm adding the filter to the news summary to show the same number of characters. My template looks like this...
Code:
{**
* @ListChild (list="itemsList.newsMessages.customer.top.row", weight="250")
*}
<span class='brief'>{model.brief_description:ShortenText}</span> <a href="{buildURL(#news_message#,##,_ARRAY_(#id#^model.id))}">Read more</a>
to give something like this on the page...
<snip>
they buy and... Read more
It all works well but... how do I make so I can choose the number of characters to show from the template? IE something like {model.brief_description:ShortenText(100)} to show 100 characters.