Online editor CKEditor (2)-PHP (31)

Source: Internet
Author: User
Pick up an article

3 In-page (in-page) configuration, direct configuration in the interface using CKEditor

In-page configuration

Effect

Features: Configuration items belong to a specific ckeditor instance, not reusable

Comparison of three configuration methods

Custom mode

Characteristics

Description

Priority level

interface functions

Flexible, no reuse

Write code once for each page that uses the editor

Highest

overriding parameters in the customization and system configuration files

Custom configuration Files

Flexible and reusable

Multiple custom profiles can be defined based on usage scenarios, referencing different profiles on different pages

Medium

overriding parameters in the system configuration file

System configuration File

Not flexible

Global nature, affecting all Programs

Minimum

The above has realized the function of editing text on line, and has not realized the function of file management.

Reason: ck separates online editing from file management. If you want to implement file management, you must use Ckfinder

Ckfinder Installation

Exactly the same as the CKEditor step

Ckfinder file Directory

Using Ckfinder

To load the use of Ckfinder in CKEditor configuration items, load several static pages, manage user files

Loading in a customized configuration file

Effect

However, because Ckfinder default is not allow users to upload files, all do not have permission to upload files

Modifying a configuration file

Open access

Locate the config.php file to open permissions

Modify permissions, open all permissions

Effect

There is a problem with the above path

Modify File Upload Path

Find the path and modify it in the config.php

modifying paths

Effect

Modify File Upload directory structure

Directory structure can not be a single folder in a file type, should be appropriate according to the amount of file upload to determine the structure of the folder. Year/month/day

Modifying the file frame structure in config.php

Modify Structure

Effect

File in the process of uploading, if the file name is Chinese or special characters, the system is no way to deal with, after uploading, will appear garbled. You need to rename the file after the file is uploaded.

Ckfinder does not provide a mechanism for duplicate names.

How is it implemented? Modify the source code.

Implementing file renaming

Source file path

Add a function to get a random name

Where do I call this function? How to use?

Effect

The current file Manager can be in the browser side of the server file additions and deletions, then this is quite dangerous, absolutely not allowed.

Controlling User Permissions

Controlling user actions on server-side files

Control of file permissions can be achieved in config.php.

Modify

Effect

File upload must be open for permission

CKEditor Edit Content Submission

    1. Add Form form, textarea must have Name property

2 Submit data after editing

3 PHP receives data, need to escape data, addslashes

4 output data, need to be reversed, stripslashes

The above describes the online editor CKEditor (2)-PHP (31), including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.