App Directory >> CakePHP TextHelper by Ajay Anturkar
CakePHP TextHelper
The TextHelper contains methods to make text more usable and friendly in your views. It aids in enabling links, formatting urls, creating excerpts of text around chosen words or phrases, highlighting key words in blocks of text, and to gracefully truncating long stretches of text.- Uses "CakePHP i18n + l10n" component by Diogo ResendeDiogo Resende with some modifications
Functions
- autoLinkEmails(string $text, array $htmlOptions=array())
- autoLinkUrls(string $text, array $htmlOptions=array())
- autoLink(string $text, array $htmlOptions=array())
- excerpt(string $haystack, string $needle, int $radius=100, string $ending="...")
- highlight(string $haystack, string $needle, array $options = array() )
- stripLinks($text)
- toList(array $list, $and='and')
- truncate(string $text, int $length=100, array $options)
How to use
$text = get::helper('text');
echo $text->autoLinkEmails("This is my email: ");// Output will have mailto link on email address
App Files
- mvc
- components
- helpers