par
graffx » 27 déc. 2009, 02:55
alors, je suis a nouveau coincé entre deux resultats, celui avec le code donné plus haut, coloré mais pas trop de mise en forme et le second, avec un background sur les quotes qui rend pas mal, mais plus rien n' est coloré, voici ce que j' ai fait pour le deuxieme resultat:
<?php
$tuto_tuto = nl2br(htmlentities(stripslashes($tuto['tuto_tuto'])));
function getGeshi($match) {
include_once('geshi/geshi.php'); // Inclure la librairie GeSHi
$language = 'php'; // Définir le langage à utiliser
$geshi = new GeSHi($match[1], $language); // Créer un objet "GeSHi"
return $geshi->parse_code(); // Retourne le résultat
}
$text = code(nl2br(htmlentities(stripslashes($tuto['tuto_tuto']))));
$text = preg_replace_callback('/\[quote\](.*?)\[\/quote\]/is', 'getGeshi', $text);
echo $text;
?>
edit:
le mieux serait que j' arrive a placer dans le preg_replace_callback:
<table width="1000" border="0" cellspacing="0" cellpadding="0"><tr><td height="20" background="images/quoteh.gif"> </td>
</tr><tr><td background="images/quotem.gif"><table width="980" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td>
Geshi</td></tr></table></td></tr><tr><td height="20" background="images/quoteb.gif"> </td></tr></table>
Saurais tu comment placer ca? Moi je n' ai eu que des erreurs, bizarre
alors, je suis a nouveau coincé entre deux resultats, celui avec le code donné plus haut, coloré mais pas trop de mise en forme et le second, avec un background sur les quotes qui rend pas mal, mais plus rien n' est coloré, voici ce que j' ai fait pour le deuxieme resultat:
[php] <?php
$tuto_tuto = nl2br(htmlentities(stripslashes($tuto['tuto_tuto'])));
function getGeshi($match) {
include_once('geshi/geshi.php'); // Inclure la librairie GeSHi
$language = 'php'; // Définir le langage à utiliser
$geshi = new GeSHi($match[1], $language); // Créer un objet "GeSHi"
return $geshi->parse_code(); // Retourne le résultat
}
$text = code(nl2br(htmlentities(stripslashes($tuto['tuto_tuto']))));
$text = preg_replace_callback('/\[quote\](.*?)\[\/quote\]/is', 'getGeshi', $text);
echo $text;
?>[/php]
edit:
le mieux serait que j' arrive a placer dans le preg_replace_callback:
<table width="1000" border="0" cellspacing="0" cellpadding="0"><tr><td height="20" background="images/quoteh.gif"> </td>
</tr><tr><td background="images/quotem.gif"><table width="980" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td>[b][color=#FF0000]Geshi[/color]<[/b]/td></tr></table></td></tr><tr><td height="20" background="images/quoteb.gif"> </td></tr></table>
Saurais tu comment placer ca? Moi je n' ai eu que des erreurs, bizarre