Hello,
Juste pour exemple, à modifier sans doute pour l'adapter à tes besoins (ça date un peu mais ça doit marcher) :
Ces 3 fichiers sont à mettre dans le répertoir ou ce trouve fckeditor.
-- le fichier config.php :
<?php
$mysql_host="localhost"; // le serveur$mysql_login="root"; // le login$mysql_pass=""; // mot de passe$mysql_dbnom="marylou"; // nom de la base de donnee$db=mysql_connect($mysql_host,$mysql_login,$mysql_pass);mysql_select_db(
$mysql_dbnom,$db);?>
--Le fichier qui appelle FckEditor :
<?php
include
(
"fckeditor.php") ;?>
<form action="postmodifdate.php" method="post" target="droite">
<?php
require
(
"config.php");//on recherche dans la base l'enregistrement pour le charger dans fckeditor
$req = mysql_query("SELECT type,html from html where type LIKE'date'");$res
= mysql_numrows($req);while
( $sortie = mysql_fetch_array($req))$html
=stripslashes($sortie[html]);$sBasePath
= $_SERVER['PHP_SELF'] ;$sBasePath
= substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;$oFCKeditor
= new FCKeditor('FCKeditor1') ;$oFCKeditor
->BasePath = $sBasePath ;$oFCKeditor
->Value = $html;$oFCKeditor
->Create() ;?>
<input type="submit" value="Submit">
</form>
-- Le fichier postmodifdate.php :<?php
$sValue
= $_POST['FCKeditor1'];require
("config.php");$requete
= "UPDATE html SET html='$sValue' WHERE type='date'";$execution
= mysql_db_query("$mysql_dbnom", $requete);print stripslashes(
$sValue);?>
-- La base de données:
CREATE TABLE `html` ( `id` int(11) NOT NULL auto_increment, `type` text, `html` text, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) ) TYPE=MyISAM;
-- Le fichier qui doit afficher le code : (il est en dehors du répertoire de fckeditor):
<?php
require
("admin/config.php");$req
= mysql_query("SELECT html from html where type LIKE'date' ");$res
= mysql_numrows($req);while
( $sortie = mysql_fetch_array($req))print
$sortie[html];?>
Ce bout de code t'enregistrera le code de fckeditor dans le champ 'html' si 'type' contient date, donc il faut que tu écrives "date" dans le champ 'type'.
@+, Yann.