Saturday, October 25, 2014

how to use ckeditor using php?[Solved]

Easy steps to Integrate ckeditor with php pages
step 1 : download the file
step 2 : paste file on root directory of the site or you can paste it where the files are (i did this one )
step 3 : extract the file
step 4 : open the desired php page you want to integrate with here page1.php
step 5 : add some javascript first below, this is to call elements of ckeditor and styling and css without this you will only a blank textarea
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
And if you are using in other sites, then use relative links for that here is one below
<script type="text/javascript" src="somedirectory/ckeditor/ckeditor.js"></script>
step 6 : now!, you need to call the work code of ckeditor on your page page1.php below is how you call it
// Make sure you are using a correct path here.
include_once 'ckeditor/ckeditor.php';

$ckeditor = new CKEditor();
$ckeditor->basePath = '/ckeditor/';
$ckeditor->config['filebrowserBrowseUrl'] = '/ckfinder/ckfinder.html';
$ckeditor->config['filebrowserImageBrowseUrl'] = '/ckfinder/ckfinder.html?type=Images';
$ckeditor->config['filebrowserFlashBrowseUrl'] = '/ckfinder/ckfinder.html?type=Flash';
$ckeditor->config['filebrowserUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files';
$ckeditor->config['filebrowserImageUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images';
$ckeditor->config['filebrowserFlashUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash';

step 7 : what ever you name you want, you can name to it ckeditor by changing the step 6 code last line
step 8 : Open-up the page1.php, see it, use it, share it and Enjoy because we all love Open Source.
Hope enjoy.!!   :)

Other way to call the ckeditor
Step below :
<?php require("ckeditor/ckeditor.php"); ?>

 <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
 <script type="text/javascript" src="somedirectory/ckeditor/ckeditor.js"></script>

<textarea class="ckeditor" name="editor1"></textarea>

No comments:

Post a Comment