3
this is a XOOPS function.
xoops/include/functions.php
/**
* Returns the portion of string specified by the start and length parameters. If $trimmarker is supplied, it is appended to the return string. This function works fine with multi-byte characters if mb_* functions exist on the server.
*
* @param string $str
* @param int $start
* @param int $length
* @param string $trimmarker
*
* @return string
*/
function xoops_substr($str, $start, $length, $trimmarker = '...')
{.. blah blah and a whole bunch of code..
wow. i just woke up.. i hope this makes sense.
the function truncates the string specified and if its more then the specified length then it puts a ... at the end.
example: (just a basic example)
$str being some string i pass to the function
0 the starting position
25 the length of the text.. it tests if it more than 25.. if yes then it adds an '...' if its not then it just shows the text.. and you can also specify to show something else besides '...' in the following example it left it out and the the fuction automatically adds the last parameter
$mytext = xoops_substr($str,0, 25);
example from the news module..but im not sure on which file to include.
$myts =& MyTextSanitizer::getInstance();
$news['teaser'] = xoops_substr(strip_tags($myts->displayTarea($story->hometext)), 0, $options[3]+3);
--
there is also a way to truncate strings with smarty.
link to GIJOE's SiteExample:
<{$news.title|xoops_substr:"0":"20"}>
edit:wow just noticed there is also and explanation on what the function does in that comment.
CBB / LatestNews / Publisher / XM-Spotlight
(ノ◕ヮ◕)ノ*:・゚✧