Form:
varoEditor=('content');
varcontent=(true);
*************************************************
It is also very easy to use Javascript to get and set FCKeditor values, as follows:
// Get HTML content in the editor
function getEditorHTMLContents(EditorName) {
var oEditor = (EditorName);
return((true));
}
// Get the Chinese content of the editor
function getEditorTextContents(EditorName) {
var oEditor = (EditorName);
return();
}
// Set content in the editor
function SetEditorContents(EditorName, ContentStr) {
var oEditor = (EditorName) ;
(ContentStr) ;
}
FCKeditor API is a global object registered after FCKeditor is loaded. Using it, we can complete various operations on the editor.
Obtain an FCK editor instance on the current page:
var Editor = ('InstanceName');
Obtain an FCK editor instance from the pop-up window of the FCK editor:
var Editor = ().FCK;
Get an FCK editor instance for other subframes from the subframes of the frame page:
var Editor = ('InstanceName');
Get the FCK editor instance of the parent window from the page popup:
var Editor = ('InstanceName');
Get the contents of the FCK editor:
(formatted); // formatted is: true|false, indicating whether to be taken out in HTML format
Also available:
();
Set the contents of the FCK editor:
("content", false); // The second parameter is: true|false, whether to set its content in the form of what you see, that is, what you get. This method is often used for "set initial value" or "form reset".
Insert content into the FCK editor:
("html"); // "html" is HTML text
Check if the FCK editor content has changed:
();
Call the FCK Editor toolbar command outside the FCK Editor:
The command list is as follows:
DocProps, Templates, Link, Unlink, Anchor, BulletedList, NumberedList, About, Find, Replace, Image, Flash, SpecialChar, Smiley, Table, TableProp, TableCellProp, UniversalKey, Style, FontName, FontSize, FontFormat, Source, Preview, Save, NewPage, PageBreak, TextColor, BGColor, PasteText, PasteWord, TableInsertRow, TableDeleteRows, TableInsertColumn, TableDeleteColumns, TableInsertCell, TableDeleteCells, TableMergeCells, TableSplitCell, TableDelete, Form, Checkbox, Radio, TextField, Textarea, HiddenField, Button, Select, ImageButton, SpellCheck, FitWindow, Undo, Redo
How to use it is as follows:
('FitWindow').Execute();
= + 'plugins/'
// ( 'placeholder', 'en,it' ) ;
After removing //, it is equivalent to adding the function of placeholder. The plug-in files of fckeditor are classified into folders under the /editor/plugins/ folder. For fckeditor 2.0, there are two folders, that is, there are two official plug-ins. The placeholder folder is what we just added. It is mainly used for matching multi-parameter or single-parameter custom labels. This is very useful when making editing templates. If you want to see specific examples, you can download the acms system to view and learn. Another folder tablecommands is used for table editing in the editor. Of course, if you want to make plugins for your other purposes, just follow the production rules of the fckeidtor plugin and place them in /editor/plugins/, and then add ('Plugin Name',',lang,lang');
Part 2: How to make the editing toolbar not appear when the editor is opened, and it will not appear when the editor is clicked "Expand Toolbar"? Easy, FCKeditor itself provides this function, open it, find
= true ;
Change to
= false ;
That's it!
The third part, use your own emoticon icon to open to the bottom section as well
= + 'images/smiley/msn/' ;
= ['regular_smile.gif','sad_smile.gif','wink_smile.gif'] ;
= 8 ;
= 320 ;
= 240 ;
The above paragraph has been modified by me. In order to prevent the layout of my post from being too widespread, I changed that line to only three emoticons.
The first line is of course the setting of the emoticon path, the second line is a list of the relevant emoticon file name, and the third line refers to the number of expressions in each line of the pop-up emoticon addition window. The following two parameters are the width and height of the pop-up modal window.
Part 4, File Upload Management Part
This part may be what everyone is most concerned about. The previous article briefly talked about how to modify it to upload files and the quick upload function provided by using fckeidtor 2.0. Let's continue to explain the upload function in depth
= true ;
= true ;
= true ; When you find these three sentences, these three sentences are not connected, but I have gathered them here. Setting to true means that you allow the use of fckeditor to browse the server-side file images and flash, etc. This function is reflected by the "Browse Server" button on the pop-up window when you insert the picture. If your editor is only used by yourself or only managed in the background, this function is undoubtedly very useful, because it allows you to upload server files intuitively. However, if your system is for front-end users or systems like blogs, this security risk is a big deal. So we set it to false;
= false ;
= false ;
= false ;
In this way, we can only upload quickly, okay! Next, let’s modify it, and use asp as the example, enter /editor/filemanager/upload/asp/ to open it, modify it
ConfigUserFilesPath = "/UserFiles/" This setting is the total directory for uploading files. I won't move here. You want to change it yourself.
OK, open the file in this directory and find the following paragraph
Dim resourceType
If ( ("Type") <> "" ) Then
resourceType = ("Type")
Else
resourceType = "File"
End If
Then add it after it
ConfigUserFilesPath = ConfigUserFilesPath & resourceType &"/"& Year(Date()) &"/"& Month(Date()) &"/"
In this way, the uploaded file will be placed in the folder "/userfiles/file type (such as image or file or flash)/year/month/". This setting is enough for single users to use. If you want to use it for multi-user systems, then change it like this
ConfigUserFilesPath = ConfigUserFilesPath & Session("username") & resourceType &"/"& Year(Date()) &"/"& Month(Date()) &"/"
In this way, the uploaded file will be placed in "/userfiles/user directory/file type/year/month/". Of course, if you don't want to arrange this, you can also modify it to something else, such as the user directory is deeper, etc. Please modify or replace the Session ("username") here according to your needs.
The uploaded directory has been set up, but the uploader will not create these folders by itself. If it does not exist, the upload will not be successful. Then we have to recurse according to the requirements of the above upload path to generate the directory.
Found this paragraph
Dim sServerDir
sServerDir = ( ConfigUserFilesPath )
If ( Right( sServerDir, 1 ) <> "\" ) Then
sServerDir = sServerDir & "\"
End If
Put these two lines below it
Dim oFSO
Set oFSO = ( "" )
Use the following code to replace it
dim arrPath,strTmpPath,intRow
strTmpPath = ""
arrPath = Split(sServerDir, "\")
Dim oFSO
Set oFSO = ( "" )
for intRow = 0 to Ubound(arrPath)
strTmpPath = strTmpPath & arrPath(intRow) & "\"
if (strTmpPath)=false then
(strTmpPath)
end if
next
Use this code to generate the folder you want, which will be automatically generated when uploading.
Okay, the modification of uploaded files can be temporarily concluded. However, there is still a problem for Chinese users, that is, the file upload of fckeditor will not be renamed by default, and Chinese file names are not supported. In this way, the uploaded file will become unreadable files such as ".jpg", and there will be duplicate files. Of course, it is nothing to do with duplicate names, because fckeditor will automatically change its name, and add (1) after the file name to identify it. However, our usual habit is to let programs automatically generate non-duplicate file names
The following is the code just now
' Get the uploaded file name.
sFileName = ( "NewFile" ).Name
I've seen it clearly, this is the file name. Let's change it. Of course, there must be a function that generates the file name, and change it to the following
'//Get a non-repeat serial number
Public Function GetNewID()
dim ranNum
dim dtNow
randomize
dtNow=Now()
ranNum=int(90000*rnd)+10000
GetNewID=year(dtNow) & right("0" & month(dtNow),2) & right("0" & day(dtNow),2) & right("0" & hour(dtNow),2) & right("0" & minute(dtNow),2) & right("0" & second(dtNow),2) & ranNum
End Function
' Get the uploaded file name.
sFileName = GetNewID() &"."& split(( "NewFile" ).Name,".")(1)
In this way, the uploaded file will automatically change its name to generate a file name like this, which is a file name composed of year, month, day, hour, minute, and three random numbers.
Copy the codeThe code is as follows:
varoEditor=('content');
varcontent=(true);
*************************************************
It is also very easy to use Javascript to get and set FCKeditor values, as follows:
Copy the codeThe code is as follows:
// Get HTML content in the editor
function getEditorHTMLContents(EditorName) {
var oEditor = (EditorName);
return((true));
}
// Get the Chinese content of the editor
function getEditorTextContents(EditorName) {
var oEditor = (EditorName);
return();
}
// Set content in the editor
function SetEditorContents(EditorName, ContentStr) {
var oEditor = (EditorName) ;
(ContentStr) ;
}
FCKeditor API is a global object registered after FCKeditor is loaded. Using it, we can complete various operations on the editor.
Obtain an FCK editor instance on the current page:
var Editor = ('InstanceName');
Obtain an FCK editor instance from the pop-up window of the FCK editor:
var Editor = ().FCK;
Get an FCK editor instance for other subframes from the subframes of the frame page:
var Editor = ('InstanceName');
Get the FCK editor instance of the parent window from the page popup:
var Editor = ('InstanceName');
Get the contents of the FCK editor:
(formatted); // formatted is: true|false, indicating whether to be taken out in HTML format
Also available:
();
Set the contents of the FCK editor:
("content", false); // The second parameter is: true|false, whether to set its content in the form of what you see, that is, what you get. This method is often used for "set initial value" or "form reset".
Insert content into the FCK editor:
("html"); // "html" is HTML text
Check if the FCK editor content has changed:
();
Call the FCK Editor toolbar command outside the FCK Editor:
The command list is as follows:
DocProps, Templates, Link, Unlink, Anchor, BulletedList, NumberedList, About, Find, Replace, Image, Flash, SpecialChar, Smiley, Table, TableProp, TableCellProp, UniversalKey, Style, FontName, FontSize, FontFormat, Source, Preview, Save, NewPage, PageBreak, TextColor, BGColor, PasteText, PasteWord, TableInsertRow, TableDeleteRows, TableInsertColumn, TableDeleteColumns, TableInsertCell, TableDeleteCells, TableMergeCells, TableSplitCell, TableDelete, Form, Checkbox, Radio, TextField, Textarea, HiddenField, Button, Select, ImageButton, SpellCheck, FitWindow, Undo, Redo
How to use it is as follows:
('FitWindow').Execute();
= + 'plugins/'
// ( 'placeholder', 'en,it' ) ;
After removing //, it is equivalent to adding the function of placeholder. The plug-in files of fckeditor are classified into folders under the /editor/plugins/ folder. For fckeditor 2.0, there are two folders, that is, there are two official plug-ins. The placeholder folder is what we just added. It is mainly used for matching multi-parameter or single-parameter custom labels. This is very useful when making editing templates. If you want to see specific examples, you can download the acms system to view and learn. Another folder tablecommands is used for table editing in the editor. Of course, if you want to make plugins for your other purposes, just follow the production rules of the fckeidtor plugin and place them in /editor/plugins/, and then add ('Plugin Name',',lang,lang');
Part 2: How to make the editing toolbar not appear when the editor is opened, and it will not appear when the editor is clicked "Expand Toolbar"? Easy, FCKeditor itself provides this function, open it, find
= true ;
Change to
= false ;
That's it!
The third part, use your own emoticon icon to open to the bottom section as well
Copy the codeThe code is as follows:
= + 'images/smiley/msn/' ;
= ['regular_smile.gif','sad_smile.gif','wink_smile.gif'] ;
= 8 ;
= 320 ;
= 240 ;
The above paragraph has been modified by me. In order to prevent the layout of my post from being too widespread, I changed that line to only three emoticons.
The first line is of course the setting of the emoticon path, the second line is a list of the relevant emoticon file name, and the third line refers to the number of expressions in each line of the pop-up emoticon addition window. The following two parameters are the width and height of the pop-up modal window.
Part 4, File Upload Management Part
This part may be what everyone is most concerned about. The previous article briefly talked about how to modify it to upload files and the quick upload function provided by using fckeidtor 2.0. Let's continue to explain the upload function in depth
= true ;
= true ;
= true ; When you find these three sentences, these three sentences are not connected, but I have gathered them here. Setting to true means that you allow the use of fckeditor to browse the server-side file images and flash, etc. This function is reflected by the "Browse Server" button on the pop-up window when you insert the picture. If your editor is only used by yourself or only managed in the background, this function is undoubtedly very useful, because it allows you to upload server files intuitively. However, if your system is for front-end users or systems like blogs, this security risk is a big deal. So we set it to false;
= false ;
= false ;
= false ;
In this way, we can only upload quickly, okay! Next, let’s modify it, and use asp as the example, enter /editor/filemanager/upload/asp/ to open it, modify it
ConfigUserFilesPath = "/UserFiles/" This setting is the total directory for uploading files. I won't move here. You want to change it yourself.
OK, open the file in this directory and find the following paragraph
Copy the codeThe code is as follows:
Dim resourceType
If ( ("Type") <> "" ) Then
resourceType = ("Type")
Else
resourceType = "File"
End If
Then add it after it
ConfigUserFilesPath = ConfigUserFilesPath & resourceType &"/"& Year(Date()) &"/"& Month(Date()) &"/"
In this way, the uploaded file will be placed in the folder "/userfiles/file type (such as image or file or flash)/year/month/". This setting is enough for single users to use. If you want to use it for multi-user systems, then change it like this
ConfigUserFilesPath = ConfigUserFilesPath & Session("username") & resourceType &"/"& Year(Date()) &"/"& Month(Date()) &"/"
In this way, the uploaded file will be placed in "/userfiles/user directory/file type/year/month/". Of course, if you don't want to arrange this, you can also modify it to something else, such as the user directory is deeper, etc. Please modify or replace the Session ("username") here according to your needs.
The uploaded directory has been set up, but the uploader will not create these folders by itself. If it does not exist, the upload will not be successful. Then we have to recurse according to the requirements of the above upload path to generate the directory.
Found this paragraph
Copy the codeThe code is as follows:
Dim sServerDir
sServerDir = ( ConfigUserFilesPath )
If ( Right( sServerDir, 1 ) <> "\" ) Then
sServerDir = sServerDir & "\"
End If
Put these two lines below it
Dim oFSO
Set oFSO = ( "" )
Use the following code to replace it
Copy the codeThe code is as follows:
dim arrPath,strTmpPath,intRow
strTmpPath = ""
arrPath = Split(sServerDir, "\")
Dim oFSO
Set oFSO = ( "" )
for intRow = 0 to Ubound(arrPath)
strTmpPath = strTmpPath & arrPath(intRow) & "\"
if (strTmpPath)=false then
(strTmpPath)
end if
next
Use this code to generate the folder you want, which will be automatically generated when uploading.
Okay, the modification of uploaded files can be temporarily concluded. However, there is still a problem for Chinese users, that is, the file upload of fckeditor will not be renamed by default, and Chinese file names are not supported. In this way, the uploaded file will become unreadable files such as ".jpg", and there will be duplicate files. Of course, it is nothing to do with duplicate names, because fckeditor will automatically change its name, and add (1) after the file name to identify it. However, our usual habit is to let programs automatically generate non-duplicate file names
The following is the code just now
' Get the uploaded file name.
sFileName = ( "NewFile" ).Name
I've seen it clearly, this is the file name. Let's change it. Of course, there must be a function that generates the file name, and change it to the following
Copy the codeThe code is as follows:
'//Get a non-repeat serial number
Public Function GetNewID()
dim ranNum
dim dtNow
randomize
dtNow=Now()
ranNum=int(90000*rnd)+10000
GetNewID=year(dtNow) & right("0" & month(dtNow),2) & right("0" & day(dtNow),2) & right("0" & hour(dtNow),2) & right("0" & minute(dtNow),2) & right("0" & second(dtNow),2) & ranNum
End Function
' Get the uploaded file name.
sFileName = GetNewID() &"."& split(( "NewFile" ).Name,".")(1)
In this way, the uploaded file will automatically change its name to generate a file name like this, which is a file name composed of year, month, day, hour, minute, and three random numbers.