• multimule

    (@multimule)


    Hi, there seems to be a problem with page titles that are exactly the maximum title length. In this case, the function title_trim has nothing to trim, but still adds … to the title.
    Suggested bugfix:

    public function title_trim($max_length)
    {
    	$title = $this->title;
    	//Make sure that we are not making it longer with that ellipse
    	if((mb_strlen($this->title) + 3) > $max_length)
    	{
    		//Trim the title
    		$this->title = mb_substr($this->title, 0, $max_length - 1);
    		//Make sure we can split a, four keywords are available %link%, %title%, %htitle%, and %type%pace, but we want to limit to cutting at max an additional 25%
    		if(mb_strpos($this->title, ' ', .75 * $max_length) > 0)
    		{
    			//Don't split mid word
    			while(mb_substr($this->title,-1) != ' ')
    			{
    				$this->title = mb_substr($this->title, 0, -1);
    			}
    		}
    		//Remove the whitespace at the end and add the hellip
    		if ( $this->title != $title ) $this->title = rtrim($this->title) . '…';
    	}
    }
Viewing 1 replies (of 1 total)
  • Plugin Author John Havlik

    (@mtekk)

    Yeah, the max_title length was never an exact cutoff, nothing would ever be longer than it, but things could end up being a bit shorter than it. Even if they began under the threshold. I guess we can firm it up a bit. There is probably a better way of doing this than what you suggested. It involves checking for strict greater than before the val+3 > max. This check has been implemented in the git development branch. See https://github.com/mtekk/Breadcrumb-NavXT/issues/18

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Breadcrumb NavXT] Problem with maximum title length’ is closed to new replies.