Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • scubabyss Friend
    #191872

    Title display gives awful display.
    Since the titles of the articles does not have the same number of characters, the title is, depending of the article, displayed on 1, 2 or 3 … lines.
    The result is that images are not properly aligned, giving an awful aspect.

    How to limit number of characters in Title to overcome this situation ?

    An alternate solution could be to swap image and title as indicated here http://www.joomlart.com/forums/topic/display-title-under-image/ however I would avoid to modify code.

    Ninja Lead Moderator
    #510833

    I’m so sorry JA Content Slider does not support option to drop text title. If you are developer you can customize it this way open default.php as this link you mentioned.

    Add new script below


    function cut_string($title, $max)
    {
    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 ='';
    }
    }

    And you can use it to drop title text


    <?php if( $params->get( 'showtitle' ) ) { ?>
    <div class="ja_slidetitle">
    <?php echo ($params->get( 'link_titles' ) ) ? '<a href="'.$link.'" title="">'.$contn->title.'</a>' : cut_string($contn->title,30);?>
    </div>
    <?php } ?>

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

This topic contains 2 replies, has 2 voices, and was last updated by  Ninja Lead 10 years, 5 months ago.

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