When users have special requirements, programmers have to study the code of Ewebeditor, which is quite troublesome. I went through this process and finally realized one of the requirements of the customer: make a link on the web page after some text, and a picture or a detailed introduction or a video appears after the user clicks it. Considering that only certain texts are displayed on the web page, I set up a function like this: when uploading, the file name should be some text to be displayed, and when uploading, we can intercept those texts (delete the file type). Considering that the files uploaded by Ewebeditor are also deleted when the administrator deletes, we must extract the paths of the files and store them in the database; and every time it is possible to upload multiple files, we must read out the paths of multiple files and store them in a field in the database table, so I wrote the paths to $_SESSION and then processed the paths of the files on another page.
1. First, you must assign uploadfile permissions to enable this folder to be written and read.
/
// Save operation
function DoSave()
{
global $sContentPath,$sSaveFileName,$sOriginalFileName;
DoUpload();
$sPathFileName = $sContentPath . $sSaveFileName;
$pathnum = count( $_SESSION["ewebpath"] );
$_SESSION["ewebpath"]["$pathnum"] = $sPathFileName;
// Get the path of the file uploaded by eweb, and write the path of each uploaded file to session, and write it to the database after getting the path on another page
/*$path = array();
$pathnum = count( $_SESSION["ewebpath"] );
for( $i=0; $i<$pathnum; $i++ )
{
$path[$i] = $_SESSION["ewebpath"][$i];
$path[$i] = substr( $path[$i], 8 ); // Here, the path is processed according to the actual situation
}
$path = implode( '|', $path );
session_unregister( "ewebpath" );*/
OutScript("('$sPathFileName');var obj=;if (!obj) obj=;try{('$sOriginalFileName', '$sSaveFileName', '$sPathFileName');} catch(e){}");
}
Modify the format of upload files supported by ewewebeditor.
/
// Take the file name to the hidden input box
function GetFileName(url, opt)
{
d_filename.value=((opt)+1);
// Take the file name without suffix (such as "Signal and System .doc" to get "Signal and System")
s1=d_filename.(".");// Split string
d_filename.value=s1[0];
}
1. First, you must assign uploadfile permissions to enable this folder to be written and read.
/
Copy the codeThe code is as follows:
// Save operation
function DoSave()
{
global $sContentPath,$sSaveFileName,$sOriginalFileName;
DoUpload();
$sPathFileName = $sContentPath . $sSaveFileName;
$pathnum = count( $_SESSION["ewebpath"] );
$_SESSION["ewebpath"]["$pathnum"] = $sPathFileName;
// Get the path of the file uploaded by eweb, and write the path of each uploaded file to session, and write it to the database after getting the path on another page
/*$path = array();
$pathnum = count( $_SESSION["ewebpath"] );
for( $i=0; $i<$pathnum; $i++ )
{
$path[$i] = $_SESSION["ewebpath"][$i];
$path[$i] = substr( $path[$i], 8 ); // Here, the path is processed according to the actual situation
}
$path = implode( '|', $path );
session_unregister( "ewebpath" );*/
OutScript("('$sPathFileName');var obj=;if (!obj) obj=;try{('$sOriginalFileName', '$sSaveFileName', '$sPathFileName');} catch(e){}");
}
Modify the format of upload files supported by ewewebeditor.
/
Copy the codeThe code is as follows:
// Take the file name to the hidden input box
function GetFileName(url, opt)
{
d_filename.value=((opt)+1);
// Take the file name without suffix (such as "Signal and System .doc" to get "Signal and System")
s1=d_filename.(".");// Split string
d_filename.value=s1[0];
}