WYSIWYG en php

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : WYSIWYG en php

par France-Webmaster » 13 janv. 2007, 22:31

Merci "Truc"

par Truc » 13 janv. 2007, 22:28

$conceptRTEvalue

par France-Webmaster » 13 janv. 2007, 22:12

Je ne suis pas sûr de son existance, faut-il créer la $variable ?


Merci, ceci me retirera une grosse épine du pied...

WYSIWYG en php

par France-Webmaster » 13 janv. 2007, 19:50

Bonjour, aprés avoir créer un system de session, je suis pourquoi ne pas créer un blog, tout va bien pour le blog création, suppréssion, modification mais pour plus de détails pourquoi ne pas utilisé du bbcode au lien d'un simple textarea, alors je me promène sur le web et là je tombe sur une démo de WYSIWYG

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...