последни теми ограничение на символите

kitchenbg

Registered
добре де, този цикъл нещо не го разбрах ....... значи имам ето този код
Код:
<?php
$max = "100";
$address = ""; //
$host = "localhost"; //db host, localhost?
$user = ""; //db user
$pass = ""; //db secret
$db = ""; //forum database

$show = "11"; //number of posts to show
$link = mysql_pconnect($host, $user, $pass) or die('Error connecting to mysql host!');
$db = mysql_select_db($db) or die('Error selecting database!');

$query = "SELECT DISTINCT u.username,t.topic_id,t.topic_title, x.post_text FROM phpbb_users u,phpbb_topics t, phpbb_posts p, phpbb_posts_text x WHERE t.topic_poster = u.user_id and t.topic_id = p.topic_id and t.topic_first_post_id = x.post_id order by t.topic_time desc limit 0,$show";
$result = mysql_query($query, $link) or die(mysql_error());

while ($row=mysql_fetch_array($result))
{
if (strlen($row[post_text])>$max)
{$thedots='...';}
else
{$thedots='';}
$text= substr($row[post_text],0 , $max);

$text = nl2br($text);
$text = preg_replace('/\s\s+/', ' ', $text);

echo ("<img src=\"../../images/q3.gif\" width=\"3\" height=\"5\" align=\"absmiddle\">    <a onmouseover=\"return overlib('<b>$row[username]</b>: $text$thedots');\" onmouseout=\"return nd();\" href='$address/viewtopic.php?t=$row[topic_id]' target=_blank>$row[topic_title]</a><br/>\n");

}
?>

кода си работи, но искам да огранича и символите на самото заглавие на темата? :shock:
 
пробвай го така:

Код:
<?php
$max = "100";
$maxs = "14";
$address = ""; //
$host = "localhost"; //db host, localhost?
$user = ""; //db user
$pass = ""; //db secret
$db = ""; //forum database

$show = "11"; //number of posts to show
$link = mysql_pconnect($host, $user, $pass) or die('Error connecting to mysql host!');
$db = mysql_select_db($db) or die('Error selecting database!');

$query = "SELECT DISTINCT u.username,t.topic_id,t.topic_title, x.post_text FROM phpbb_users u,phpbb_topics t, phpbb_posts p, phpbb_posts_text x WHERE t.topic_poster = u.user_id and t.topic_id = p.topic_id and t.topic_first_post_id = x.post_id order by t.topic_time desc limit 0,$show";
$result = mysql_query($query, $link) or die(mysql_error());

while ($row=mysql_fetch_array($result))
{
if (strlen($row[post_text])>$max)
{$thedots='...';}
else
{$thedots='';}
$text= substr($row[post_text],0 , $max);

if (strlen($row[topic_title])>$maxs)
{$thedotss='...';}
else
{$thedotss='';}
$texts= substr($row[topic_title],0 , $maxs);

$text = nl2br($text);
$text = preg_replace('/\s\s+/', ' ', $text);

$texts = nl2br($texts);
$texts = preg_replace('/\s\s+/', ' ', $texts);

echo ("<img src=\"../../images/q3.gif\" width=\"3\" height=\"5\" align=\"absmiddle\">    <a onmouseover=\"return overlib('<b>$row[username]</b>: $text$thedots');\" onmouseout=\"return nd();\" href='$address/viewtopic.php?t=$row[topic_id]' target=_blank>$texts$thedotss</a><br/>\n");

}
?>
 
Еми оверлиб ?

Код:
Notice: Use of undefined constant post_text - assumed 'post_text' in c:\program files\easyphp1-8\www\sit\10.php on line 19

Notice: Undefined index: post_text in c:\program files\easyphp1-8\www\sit\10.php on line 19

Notice: Use of undefined constant post_text - assumed 'post_text' in c:\program files\easyphp1-8\www\sit\10.php on line 23

Notice: Undefined index: post_text in c:\program files\easyphp1-8\www\sit\10.php on line 23

Notice: Use of undefined constant topic_title - assumed 'topic_title' in c:\program files\easyphp1-8\www\sit\10.php on line 25

Notice: Use of undefined constant topic_title - assumed 'topic_title' in c:\program files\easyphp1-8\www\sit\10.php on line 29

Имам грешка!
 
overlib.js

П.П. Попълни ли си данните?

Код:
$max = "100"; 
$maxs = "14"; 
$address = ""; // 
$host = "localhost"; //db host, localhost? 
$user = ""; //db user 
$pass = ""; //db secret 
$db = ""; //forum database
 
Да!

Оправих го но искам да изважта категорията и оверлиба не ми работи!

Ако може и да се добави скрол като в дата.бг сте златни!!! 8)
 
LuXiRiS каза:
Да!

Оправих го но искам да изважта категорията и оверлиба не ми работи!

Ако може и да се добави скрол като в дата.бг сте златни!!! 8)
Какво точно искаш, че нещо немога да те разбера!
 

Back
Горе