Intégrer ckeditor

Résolu
77dom77 Messages postés 7 Date d'inscription lundi 21 janvier 2008 Statut Membre Dernière intervention 15 juin 2011 - 13 juin 2011 à 22:23
cod57 Messages postés 1653 Date d'inscription dimanche 7 septembre 2008 Statut Membre Dernière intervention 11 septembre 2013 - 14 juin 2011 à 14:13
Bonsoir,

Au secours! Je n'arrive pas à remplacer un textarea par l'editeur ckeditor!
Je n'avais pas de pb avec l'ancienne version fckeditor, mais là je sèche.
J'ai téléchargé le guide pour développeur et testé l'exemple mais rien.
La page à faire est en php...

Si quelqu'un à un code simple qui fonctionne histoire que je comprenne le principe, afin de continuer avec ckeditor ou alors avec mieux!

merci d'avance

Dom

7 réponses

cod57 Messages postés 1653 Date d'inscription dimanche 7 septembre 2008 Statut Membre Dernière intervention 11 septembre 2013 19
14 juin 2011 à 10:37
bonjour
un exemple basique
en supposant que tu es tous les javascripts
au bon endroit
je reprend un exemple officiel
a++


<?php
if(isset($_POST)){
echo '';
print_r($_POST);
echo '';
}else{
}
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
-->
<html xmlns= "http://www.w3.org/1999/xhtml">
<head>
<title>Skins &mdash; CKEditor Sample</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<script type="text/javascript" src="ckeditor.js"></script>
<script src="sample.js" type="text/javascript"></script>
<link href="sample.css" rel="stylesheet" type="text/css" />
</head>


CKEditor Sample &mdash; Skins





This sample shows how to automatically replace <code><textarea>
elements
with a CKEditor instance using a specific skin.



CKEditor with a specified skin (in this case, the "Office 2003" skin) is inserted with a JavaScript call using the following code:


CKEDITOR.replace( 'textarea_id',
{
skin : 'office2003'
});



Note that
textarea_id
in the code above is the
id
attribute of
the
<textarea>
element to be replaced.





<!-- This
holds alert messages to be display in the sample page. -->


<noscript>

CKEditor requires JavaScript to run. In a browser with no JavaScript
support, like yours, you should still see the contents (HTML data) and you should
be able to edit it normally, without a rich editor interface.


</noscript>





<!-- le formulaire pointe sur lui même avec action =""
mais tu peux choisir une autre destination traitement.php par exemple-->


<form action= "" method="post">
"Kama" skin

The default skin used in CKEditor. No additional configuration is required.



<textarea cols="80" id="editor_kama" name="editor_kama" rows="10">This is some sample text . You are using CKEditor.

</textarea>
<script type ="text/javascript">
//<![CDATA[

CKEDITOR.replace( 'editor_kama',
{
skin : 'kama'
});

//]]>
</script>


"Office 2003" skin

Use the following code to configure a CKEditor instance to use the "Office 2003" skin.


CKEDITOR.replace( 'textarea_id',
{
skin : 'office2003'
});



<textarea cols= "80" id="editor_office2003" name="editor_office2003" rows="10">This is some sample text . You are using CKEditor.

</textarea>
<script type ="text/javascript">
//<![CDATA[

CKEDITOR.replace( 'editor_office2003',
{
skin : 'office2003'
});

//]]>
</script>


"V2" skin

Use the following code to configure a CKEditor instance to use the "V2" skin.


CKEDITOR.replace( 'textarea_id',
{
skin : 'v2'
});


<textarea cols= "80" id="editor_v2" name="editor_v2" rows="10">This is some sample text . You are using CKEditor.

</textarea>
<script type ="text/javascript">
//<![CDATA[

CKEDITOR.replace( 'editor_v2',
{
skin : 'v2'
});

//]]>
</script>




</form>


<hr />

CKEditor - The text editor for the Internet - http://ckeditor.com



Copyright © 2003-2011, CKSource - Frederico
Knabben. All rights reserved.





</html>
</code>

Bonne programmation !
3
Rejoignez-nous