Hallo,
Kan er mij iemand helpen ik maakte deze 2 functies, maar wanneer ik title_resize een string meegeef komt uiteindelijk toch de volledige string eruit.
Ziet er iemand wat er fout is?
Alvast bedankt!

implode_functie

<? { ?>
function implode_array ($values_array = null, $glue = ',', $array_check = true, $default_result = '0')
{
	(string) $result = $default_result;
	(array) $formatted_array = null;
		
	if ($array_check)
		{
		if (is_array($values_array))
		{
			foreach ($values_array as $value)
			{
				$formatted_array[] = (empty($value)) ? 0 : $value;
			}				
		}			
	            else 
	           {
	   	            $formatted_array[] = $default_result;
	            }
	}
	else 
	{
		$formatted_array = $values_array;
	}
			
	$result = @implode($glue, $formatted_array);

	return $result;
}
<? } ?>



title resize_functie

<? { ?>
function title_resize($text, $max_length = 15, $fulltext = false)
{
	global $db;
	(string) $output = null;

	$text = $db->add_special_chars($text);
	
	if ($fulltext)
	{
		$output = (strlen($text) > $max_length) ? substr($text, 0, $max_length - 3) . '... '  : $text;
	}
	else 
	{
		$text_words = explode(' ', $text);
	
		$nb_words = count($text_words);
	
		for ($i=0; $i<$nb_words; $i++)
		{
			$display_output[] = (strlen($text_words[$i]) > $max_length) ? substr($text_words[$i], 0, $max_length-3) . '... ' : $text_words[$i];
		}
		
		$output = $db->implode_array($display_output, ' ', true, '');
	}

	return $output;
}
<? } ?>

Reageren