Removing three dots / ellipsis in newest and topten display

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
skysaw
Posts: 21
Joined: Wed Jan 04, 2006 7:56 am

Removing three dots / ellipsis in newest and topten display

Post by skysaw »

What's the best way to go about removing the trailing three dots (ellipsis: ...) that are added to the trimmed content titles in the {writeNewestRow} and {writeTopTenRow} outputs?

Thanks,

Ed
skysaw
Posts: 21
Joined: Wed Jan 04, 2006 7:56 am

Never mind, I found it...

Post by skysaw »

In functions.php, I just removed the ellipsis from the line

Code: Select all

$shortStr .= "...";
I was worried that this line:

Code: Select all

$str = ereg_replace("[[:space:]]+", " ", $str);
would create a trailing space at the end of the link, but it doesn't seem to have happened (at least in Firefox and IE). Here's the whole thing below, in case someone else wants to do the same. (I'm doing it because I'll be reviewing all content and creating a brief "title" and incorporating the longer question in the answer block.)

Ed

Code: Select all

function makeShorterText($str, $char)
{
	$str = ereg_replace("[[:space:]]+", " ", $str);
	$arrStr = explode(" ", $str);
	$shortStr = "";
    $num = count($arrStr);
	if ($num > $char) {
		for ($j = 0; $j <= $char; $j++) {
			$shortStr .= $arrStr[$j]." ";
			}
		$shortStr .= "";
		}
	else {
		$shortStr = $str;
		}
	return $shortStr;
}
Post Reply