topic Titel nach zb 30 Buchstaben abschneiden
Verfasst: So 30.Jul, 2006 23:14
Hallo,
wie kann ich hier bei den Themen titel die letzten Buchstaben abschneiden das dann zb ... steht ?
Ich eröffne ein neues Thema im Forum und als titel wähle ich
Das ist ein neues Thema
dieses sollte dann abgescnitten werde in zb
Das ist ein neues ...
aber das abschneiden sollte erst nach zb 30 buchstaben kommen.
wie kann ich hier bei den Themen titel die letzten Buchstaben abschneiden das dann zb ... steht ?
Ich eröffne ein neues Thema im Forum und als titel wähle ich
Das ist ein neues Thema
dieses sollte dann abgescnitten werde in zb
Das ist ein neues ...
aber das abschneiden sollte erst nach zb 30 buchstaben kommen.
Code: Alles auswählen
$sql = "SELECT t.topic_title, p.post_time
FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p
LEFT JOIN " . FORUMS_TABLE . " f ON t.forum_id = f.forum_id
WHERE p.post_id = t.topic_last_post_id
AND f.auth_view < 2
ORDER BY t.topic_last_post_id DESC LIMIT 0,1";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain last topic data', '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result))
{
$latest_topic = $row['topic_title'];
}
$db->sql_freeresult($result);
$image = "../images/signature.png";
$im = imagecreatefrompng($image);
$tc = ImageColorAllocate ($im, 176, 176, 176);
$red = ImageColorAllocate ($im, 225, 0, 0);
$black = ImageColorAllocate ($im, 0, 0, 0);
$blue = ImageColorAllocate ($im, 0, 102, 153);
$total_users = get_db_stat('usercount');
$total_posts = get_db_stat('postcount');
$total_topics = get_db_stat('topiccount');
$j = strlen($total_users);
$leerzeichen = $j*6+237;
//
// hier mein versuch
// klappt aber nicht
// ich sehe nur ...
//
// $j = strlen($total_users);
// $leerzeichen = $j*6+237;
// $j2 = strlen($latest_topic);
// if (($j + $j2)>38)
// {
// $words = explode (" ", $latest_topic);
// $text = '';
// $latest_topic = '';
// for($i=0;strlen($text) < (35 - $j);$i++) {
// $text = $text . $words[$i] . " ";
// }
// $latest_topic = str_replace($words[$i-1],"...",$text);
// }
//////////////////////////////////////////////////