Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • environc Friend
    #188500

    Hi, Character limits in both job list and employer list is cutting off whole words, like “last wor…” . How do I make sure that if the character limit falls within a whole word, then the previous word becomes the last word, like “last…”. Regards

    HeR0 Friend
    #497011

    Hi Environc,

    Please open file componentscom_jajobboardhelperjahelper.php and replace function Trim by editting as below
    [PHP]function trim($strin, $pos = 0, $len = 10000, $hiddenClasses = ”)
    {
    $strout = trim($strin);

    $pattern = ‘/(<[^>]*>)/’;
    $arr = preg_split($pattern, $strout, -1, PREG_SPLIT_DELIM_CAPTURE);
    $left = $pos;
    $length = $len;
    $strout = ”;

    for ($i = 0;$i < count($arr); $i++) {
    $arr[$i] = trim($arr[$i]);

    if ($arr[$i] == ”) {
    continue;
    }

    if ($i % 2 == 0) {
    if ($left > 0) {
    $t = $arr[$i];
    $arr[$i] = substr($t, $left);
    $left -=(strlen($t) – strlen($arr[$i]));
    }

    if ($left <= 0) {
    if ($length > 0) {
    $t = $arr[$i];
    $arr[$i] = substr($t, 0, $length);

    $poskey = strrpos($arr[$i], ” “);
    if($poskey) {
    $arr[$i] = substr($arr[$i], 0, $poskey).”…”;
    }

    $length -= strlen($arr[$i]);

    if ($length <= 0) {
    $arr[$i] .= ‘…’;
    }
    } else {
    $arr[$i] = ”;
    }
    }
    } else {
    if (SmartTrim::isHiddenTag($arr[$i], $hiddenClasses)) {
    $endTag = SmartTrim::getCloseTag($arr, $i);

    if ($endTag) {
    while($i<$endTag) $strout .= $arr[$i++].”n”;
    }
    }
    }

    $strout .= $arr[$i].”n”;
    }

    return SmartTrim::toString($arr, $len);
    }[/PHP]
    Hope this helps.

    Regards

    environc Friend
    #497049

    Hi Hero, Thanks. That worked great

Viewing 3 posts - 1 through 3 (of 3 total)

This topic contains 3 replies, has 2 voices, and was last updated by  environc 11 years, 2 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum