et voici le code en php :
<?
$PHP_SELF=$_SERVER["PHP_SELF"];
if (isset($_POST["language"])){$language = $_POST["language"];}else{$language = 'FR';}
if (isset($_POST["action"])){$action = $_POST["action"];}else{$action = '';}
if (isset($_POST["conceptRTEvalue"])){$conceptRTEvalue = $_POST["conceptRTEvalue"];}else{$conceptRTEvalue = '';}
echo "<html>";
echo "<head>";
echo "<title>ConceptRTE Demo - Rich Text Editor</title>";
echo "<script language='JavaScript' type='text/javascript' src='conceptRTE.js'></script>";
echo "<link rel='STYLESHEET' type='text/css' href='style.css'>";
echo "</head>";
echo "<body>";
//============================================================================//
// ConceptRTE's description //
//============================================================================//
echo "<div class=row>";
echo "<span class=rteColumn>";
echo "<script language='JavaScript' type='text/javascript'>";
$content = RTESafe($conceptRTEvalue);
//============================================================================//
// Usage: initRTE(imagesPath, includesPath, cssFile, language) //
//============================================================================//
echo "initRTE('images/', '', 'style.css', '$language');";
//============================================================================//
// Usage: writeRichText(fieldname, html, width, height, buttons) //
//============================================================================//
echo "writeRichText('rte', '$content', 520, 200, true, false);";
echo "</script>";
echo "</span>";
//============================================================================//
// Download the source //
//============================================================================//
//============================================================================//
// write resulting document in a separate html page and display in a pop-up //
//============================================================================//
if ($action == 'show') {
$currentDate = date("Ymd");
$currentTime = date("His");
$fileName = $currentDate . $currentTime . ".html";
$conceptRTEvalue = str_replace(chr(92).chr(34),chr(34),$conceptRTEvalue);
$fp = fopen($fileName,"w");
fputs($fp,"<html>");
fputs($fp,"<head>");
fputs($fp,"<title>ConceptRTE Demo - Rich Text Editor</title>");
fputs($fp,"<link rel='STYLESHEET' type='text/css' href='style.css'>");
fputs($fp,"</head>");
fputs($fp,"<body>");
fputs($fp,$conceptRTEvalue);
fputs($fp,"</body>");
fputs($fp,"</html>");
fclose($fp);
echo "<script>";
echo "parameter = 'toolbar=no,menubar=no,location=no,resizable=no,status=no,scrollbars=yes,height=400,width=800,left=150,top=150';";
echo "OpenWin = this.open('$fileName', 'conceptRTEpopUp', parameter);";
echo "</script>";
}
//============================================================================//
// providing safe data for ConceptRTE //
//============================================================================//
function RTESafe($strText) {
$tmpString = trim($strText);
if ($tmpString == "") {
$tmpString = "<P class=MsoNormal style=\"MARGIN: 0cm 0cm 0pt\"></P>";
}
//convert all types of single quotes
$tmpString = str_replace(chr(145), chr(39), $tmpString);
$tmpString = str_replace(chr(146), chr(39), $tmpString);
$tmpString = str_replace("'", "'", $tmpString);
//convert all types of double quotes
$tmpString = str_replace(chr(147), chr(34), $tmpString);
$tmpString = str_replace(chr(148), chr(34), $tmpString);
//replace carriage returns & line feeds
$tmpString = str_replace(chr(10), " ", $tmpString);
$tmpString = str_replace(chr(13), " ", $tmpString);
return $tmpString;
}
?>
Le petit soucis c'est qu ne trouve pas la variable $ qui affiche la valeur du textarea... Je voudrait en faite utiliser cette valeur dans une autre page... (envoyer à la base... (ça je sais faire à présent))Aperçu de l'effet sur http://info.aqua.free.fr/bbcodeaakaria/
Merci...