// Renvoie le titre trouve dans la $table_parent, là où $champ = $id function cs_titre_id($id, $table_parent='rubriques', $champ='id_rubrique') { // retour nul si pas de parent a priori if(!$id) return ''; // Utiliser la bonne requete en fonction de la version de SPIP if(function_exists('sql_getfetsel')) { // SPIP 2.0 if($titre = sql_getfetsel('titre', "spip_$table_parent", " $champ=$id")) return $titre; } else { if($r = spip_query("SELECT titre FROM spip_$table_parent WHERE $champ=$id")) // s'il existe un champ, on le retourne if($row = spip_fetch_array($r)) return $row['titre']; } // sinon, rien ! return ''; }