Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • cyan Friend
    #183809

    Good Morning
    Dear your work is amazing, I really liked the staff, but I would like a little help with K2?

    K2
    As I can limit the number of characters in the description in the intro of the article, when I do it from the category configuarcion works but I lost the image of introduction?

    I look forward to your prompt help?

    Ninja Lead Moderator
    #479209

    You can try with my solutions:
    <blockquote>templates/ja_wall/template_tools.php</blockquote>
    Add new script front public static function getExClass($k2item)

    public static function DropText($title, $max=100)
    {
    if($title!=''){
    if(is_array($title)) list($string, $match_to) = $title;
    else { $string = $title; $match_to = $title{0}; }

    $match_start = stristr($string, $match_to);
    $match_compute = strlen($string) - strlen($match_start);

    if (strlen($string) > $max)
    {
    if ($match_compute < ($max - strlen($match_to)))
    {
    $pre_string = substr($string, 0, $max);
    $pos_end = strrpos($pre_string, " ");
    if($pos_end === false) $string = $pre_string."...";
    else $string = substr($pre_string, 0, $pos_end)."...";
    }
    else if ($match_compute > (strlen($string) - ($max - strlen($match_to))))
    {
    $pre_string = substr($string, (strlen($string) - ($max - strlen($match_to))));
    $pos_start = strpos($pre_string, " ");
    $string = "...".substr($pre_string, $pos_start);
    if($pos_start === false) $string = "...".$pre_string;
    else $string = "...".substr($pre_string, $pos_start);
    }
    else
    {
    $pre_string = substr($string, ($match_compute - round(($max / 3))), $max);
    $pos_start = strpos($pre_string, " "); $pos_end = strrpos($pre_string, " ");
    $string = "...".substr($pre_string, $pos_start, $pos_end)."...";
    if($pos_start === false && $pos_end === false) $string = "...".$pre_string."...";
    else $string = "...".substr($pre_string, $pos_start, $pos_end)."...";
    }

    $match_start = stristr($string, $match_to);
    $match_compute = strlen($string) - strlen($match_start);
    }

    return $string;
    }else{
    return $string ='';
    }
    }

    <blockquote>templates/ja_wall/html/com_k2/ja_wall/category_item.php</blockquote>
    from

    $introtext = '<p>'.$introtext.'</p>';
    change to

    $introtext = '<p>'.WallHelper::DropText($this->item->introtext).'</p>';

    Or you can apply this fix with all customize view k2 component
    <blockquote>templates/ja_wall/html/com_k2</blockquote>

    cyan Friend
    #479361

    Thanks for your help but I have no results yet when I set the number of words in the category of K2 input image disappears

    I could please send the files to put on my server.

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

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

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