Nulla da fare..ho provato ma credo di aver scritto una porcheria
Codice PHP:
<?php
$result = mysql_query("SELECT *, date_format(data, '%d/%m') as data_format FROM news ORDER BY id DESC LIMIT 0,20")
or die("Query non valida: " . mysql_error());
function strSelect( $myString, $maxLength ) {
// andr3a
$out = "";
$s = explode( " ",$myString );
for( $i = 0, $cs = count( $s ); $i < $cs; $i++ ) {
$out .= $s[$i]." ";
if( isSet( $s[$i+1] ) && ( strlen( $out ) + strlen( $s[$i+1] ) ) > $maxLength ) {
break;
}
}
return rtrim( $out );
}
while ($row = mysql_fetch_array($result))
{ echo "»$row[data_format][b]<a href=\"news/news.php?id=$row[id]\"title=\"$row[titolo]\"> $row[titolo]</a>[/b]
strSelect($row[testo],20)<hr>";}
?>