Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • vernontee Friend
    #869587

    For the words before the read more tag, the last word is always removed and replaced with "…" . Please see screenshot attached.


    1. 2016-01-27_18h23_57
    2. 2016-01-27_18h24_19
    Saguaros Moderator
    #870305

    Hi

    You’re mentioning the articles in Articles Category module in Homepage, right?

    Just go to Extensions > Modules > find Articles Category module you want to change > Display Options tab > change the limit value for the introtext as you wish: http://prntscr.com/9vs7qx

    vernontee Friend
    #875034

    Its not related to the "limit". The bug is that the system will remove the LAST WORD regardless of the limit. Do take a look at the previous screenshots.

    Saguaros Moderator
    #875101

    You can update credentials of your site: URL & Admin account in this topic so I can have a look

    http://static.joomlart.com/images/blog/2015/nov/Add-new-post.gif

    vernontee Friend
    #875155
    This reply has been marked as private.
    Saguaros Moderator
    #876114

    I checked your site and saw that it belongs to the featured articles of your site. You can try this tweak:

    • Open the file: ROOT/templates/ja_magz_ii/html/com_content/featured/default.php

    • Underneath this line:

    defined('_JEXEC') or die;

    add this code snippet:

    if(!function_exists('cut_string')){
    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 ='';
    }
    }
    }
    • Find the following line of code:

      <?php 
      $this->item->introtext = substr(strip_tags($this->item->introtext), 0, 200);
      $this->item->introtext = substr($this->item->introtext, 0, strrpos($this->item->introtext, ' ')) . " ...";
      echo $this->item->introtext;
      ?>

      Change it to:

      <?php 
          echo cut_string($this->item->introtext, 300);
      ?>

    Then change 300 to your desired value

    Hope it helps.

    vernontee Friend
    #876230

    would you mind to give me the file that i can just replace instead? So much code im afraid i paste it in create some error somewhere…. and btw.. i cant find code you were asking for in that file either

    Saguaros Moderator
    #876794

    I attach it below.

    You can download and unzip & copy to directory: ROOT/templates/ja_magz_ii/html/com_content/featured/

    Remember to backup the old file first.

    To change number of character, check line 117: echo cut_string($this->item->introtext, 300);


    1. default_item.php_.zip
    vernontee Friend
    #884466

    solved thanks

    vernontee Friend
    #885579

    Hi this is not solved…. it was only solved in the home page but not the other menu items…. its ok here

    http://rapidfy.com/blog/

    but not here

    http://rapidfy.com/blog/home-living/
    http://rapidfy.com/blog/events/
    and so on…

    Saguaros Moderator
    #885954

    Yes, the above solution is applied for Featured Blog content in homepage. Try to check the menu item of that page and see which type it is, then apply the same changes as above for associated file of that menu item.

    The associated file locate in this path: ROOT/templates/ja_magz_ii/html/com_content/category/

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

This topic contains 10 replies, has 2 voices, and was last updated by  Saguaros 8 years, 9 months ago.

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