Doesn't this add one query for every thread shown in forumdisplay. At the default that is 15 new queries shown for every forumdisplay page which can add up a to a lot of resources.
A better solution would be to:
1) Add a new "preview" field to the thread table.
2) Move the code that generates the snippet to the newthread.php file.
PHP Code:
$page=iif(strlen($message>500,substr($message,0,500)."...",$message);
Place that above the line that begins:
PHP Code:
$DB_site->query("INSERT INTO thread
Alter that same INSERT query to insert the preview as well.
4) Alter the statement that begins with:
PHP Code:
$threads=$DB_site->query("
so that is pulls the preview from the database as well.
5) Finally in forumdisplay.php you add the other two lines where you had them to begin with:
PHP Code:
$page=bbcodeparse2($page,1,1,1,1);
$page=strip_tags($page);
This will give you now new queries while pulling the thread information.
If you have dot folders turned on you can edit the $dotuserid string to pull the message information and get by with less coding and still not have any new queries at display time.