이 기능을 사용하는 제목의 크기를 조정해야하지만 다음과 같이 작동합니다. car ... for ... 1991 1991 TOYOTA 1.6 16 VALF 15 개의 단어로 제한하고 싶습니다. 기능 제목 크기 조정 doesnt work 2
function title_resize($text, $max_length = 15, $fulltext = false)
{
global $db;
(string) $display_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;
}
어떻게 이런 짓을 할 수
: 여기car for sale 1...
내 코드인가? (이 항목은 구경에게입니다 ...) USAC :
<?=title_resize($item_details['name']);?>
어떤 오류가 발생합니까? – Zeeshan