Grazie mille per la risposta ma ho risolto con questo script che pubblico per chi ne avesse bisogno :
<?
mysql_select_db("spip", $db) //seleziono il database di spip
$query="SELECT * from spip_breves WHERE statut = 'publie' ORDER BY id_breve DESC LIMIT 1"; //cerco l' ultima breve
$result = mysql_query($query, $db);
$row = mysql_fetch_array($result);
function TagliaStringa($stringa, $max_char){//funzione per tagliare il testo - Il numero dei caratteri a cui si vuole tagliare va inserito dove viene utilizzata la funzione
if(strlen($stringa)>$max_char){
$stringa_tagliata=substr($stringa, 0,$max_char);
$last_space=strrpos($stringa_tagliata," ");
$stringa_ok=substr($stringa_tagliata, 0,$last_space);
return $stringa_ok."...";
}else{
return $stringa;
}
}?>
<? echo ($row[id_breve]);?>
">
<? echo ($row[titre])?>
<?
$text=$row[texte];
$newtext = TagliaStringa($text, 40);
?>
<? echo $newtext;?>