CKEditor 4 và CFinder 3 – PHP

Hướng dẫn cài đặt CKEditor 4 và Cfinder 3

  • Tải CKEditor, CKFinder ở 2 link sau

https://ckeditor.com/ckeditor-4/
https://ckeditor.com/ckeditor-4/download/#ckfinder (3.4.2)

  • Giải nén và chép ckeditor, cfinfer vào thư mục gốc của website (web root folder)
  • Cấu hình cfinder tích hợp với ckeditor

Thay đổi $config[‘authentication’] file config.php nằm trong thư mục cfinder như sau

$config[‘authentication’] = function () {
return true; // FALSE -> TRUE
};

  • Add CKEditor vào trang web

src=”ckeditor/ckeditor.js”>
src=”ckfinder/ckfinder.js” type=”text/javascript”>

Thành phần TEXT EDITOR //TextArea
<textarea name=”editor1″ id=”editor1″ rows=”10″ cols=”80″>
This is my textarea to be replaced with CKEditor.
</textarea>
//Script for CKEditor

// Replace the with a CKEditor
// instance, using default configuration.
var editor = CKEDITOR.replace( ‘editor1’, {
filebrowserBrowseUrl: ‘ckfinder/ckfinder.html’,
filebrowserImageBrowseUrl: ‘ckfinder/ckfinder.html?type=Images’,
filebrowserFlashBrowseUrl: ‘ckfinder/ckfinder.html?type=Flash’,
filebrowserUploadUrl: ‘ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files’,
filebrowserImageUploadUrl: ‘ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images’,
filebrowserFlashUploadUrl: ‘ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash’
});
CKFinder.setupCKEditor( editor, {
skin: ‘jquery-mobile’,
swatch: ‘b’,
onInit: function( finder ) {
finder.on( ‘files:choose’, function( evt ) {
var file = evt.data.files.first();
console.log( ‘Selected: ‘ + file.get( ‘name’ ) );
} );
}
} );

 

Advertisements

Echo (PHP) vs Print (PHP)

echo() and print() are not functions but language constructs in PHP. They are both used to output strings and there are very minor differences between echo and print in PHP.

Comparison chart</> EMBED THIS CHART

Echo (PHP) Print (PHP)
Parameters: echo can take more than one parameter when used without parentheses. The syntax is echo expression [, expression[, expression] … ]. Note that echo ($arg1,$arg2) is invalid. print only takes one parameter.
Return value: echo does not return any value print always returns 1 (integer)
Syntax: void echo ( string $arg1 [, string $… ] ) int print ( string $arg )
What is it?: In PHP, echo is not a function but alanguage construct. In PHP, print is not a really function but a language construct. However, it behaves like a function in that it returns a value.