user147685
user147685

Reputation: 469

PHP How to add editor to a new page

i want to add an editor(see pic http://img8.imageshack.us/img8/7664/editorw.jpg attach) to a my webpage. How can i do that?!

Upvotes: 0

Views: 1157

Answers (2)

RageZ
RageZ

Reputation: 27323

the editor you have in your screenshot is somekind of FCK Editor. you can download CKEditor (the new version of FCKEditor) and use the following code to create an editor in your pages:

<script type="text/javascript" src="ckeditor.js"></script>    
<textarea cols="80" id="editor2" name="editor2" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a 

href="http://www.fckeditor.net/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
                <script type="text/javascript">
                //<![CDATA[

                    // This call can be placed at any point after the
                    // <textarea>, or inside a <head><script> in a
                    // window.onload event handler.

                    // Replace the <textarea id="editor"> with an CKEditor
                    // instance, using default configurations.
                    CKEDITOR.replace( 'editor2' );

                //]]>
                </script>

make sure you include the valid path to ckeditor.js also you can consult the documentation for more details.

Also make sure you have cleaning code for user input (like white list of tags) because if you don't your site is going to be vunerable to XSS attacks.

Upvotes: 1

Lukman
Lukman

Reputation: 19164

If you are asking about HTML editor, then check out TinyMCE or CKEditor :)

Upvotes: 0

Related Questions