Page 3 of 3

Posted: Thu Oct 05, 2006 7:24 pm
by s.dot
I added a piece that will chop the title at the nearest whole word if the title exceeds $maxlength.. so you don't end up with half a word in a title.

IE:
title: "some long url with words chopped in half"
set to false: some-long-url-with-words-cho.html
set to true: some-long-url-with-words.html

[edit]
I used this code to do this:

Code: Select all

$text = explode('-',$text); 
$text = implode('-',array_diff($text,array(array_pop($text))));
If there is a function that will pop the last element of an array off and return the array minus that element, let me know. array_pop() returns only the last element, so i had to throw an array_diff() in there.

Posted: Thu Oct 05, 2006 7:44 pm
by Luke
don't know if this would be any better or not...

Code: Select all

$text = implode('-',array_slice($text, 0, count($text)-1));