Hi,
I have the calendar module running and have a nice block displayed in the front page of my site...

sombody has posted "Skaville Presents ......DubDadda (Zion Train) + Cracked Actors " in the band name....
and it has made my block look s**t....

Is there anyway way i can use a filter or somthing to make it a max of 10 chars or somthing so insted of this
Skaville Presents ......DubDadda (Zion Train) + Cracked Actors
we get

Skaville Prese....

Thanks in advance

Comments

yuriy.babenko’s picture

Without going into detail into the module you're describing...

Find the place that outputs the variable, and cut it down either by using the PHP function strlen() or by using this custom function that I wrote to cut the string at the last space character (so words don't get cut in half):

function _cut_string($string, $length = 160)
{
	if(strlen($string) > $length)
	{
		$string = substr($string, 0, $length);
		$pos = strrpos($string, " ");
		
		if($pos === false)
			return $string;
		
		$string = substr($string, 0, $pos);
		$string .= "...";
	}
			
	return $string;
}

---
Yuriy Babenko
www.yubastudios.com

---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com

nevets’s picture

An alternative approach is to use css to limit the height/width for text and set overflow to clip for the element.