Discuz! Common Program functions and variables

Source: Internet
Author: User
Common function: showmessage () function: This function is the most common page prompt jump, such as login, exit, personal information modification and submission. Demo: Function prototype: showmessage ($ message, $ url_forward, $ extra, $ forwardtype0) function explanation: in our Discuz! In the php file, you can

Common functions:
Showmessage () function
: This function is the most common page prompt jump, such as login, exit, personal information modification and submission.
Demo:

Function prototype:

Showmessage ($ message, $ url_forward = '', $ extra ='', $ forwardtype = 0)

Function explanation: In our Discuz! In the php file, you can use this function to specify the page to jump to and customize the prompt information during the jump.
There are four parameters. The first parameter is a required parameter, and the last three parameters are optional. this parameter is optional, which means you do not need to enter them when using them. of course, there is no error in filling them out;
The first parameter is the prompt information during the jump, for example, "your modifications have been submitted and are currently redirecting for you ";
The second parameter is the url of the page to jump to. it specifies the page to jump to. it can be an absolute URL or a relative address, for example, "index. php is to jump to the home page.
The third and fourth parameters are optional. for our webmaster, they are basically unavailable and do not need to be further explored. Usually two parameters are used.

Example: Showmessage ('your changes have been submitted, returning the homepage for You ', 'index. php ');

Certificate ------------------------------------------------------------------------------------------------------------------------------------------------------

Sendpm () function: This function is used to send short messages (including private messages, system messages, and reminder messages ).

Function prototype:

Sendpm ($ toid, $ subject, $ message, $ fromid = '');

Function explanation: same in Discuz! In the php file, we can use this function to send short messages.
There are four parameters, the first three are mandatory, and the last is optional;
The first parameter is the UID of the user who receives the short message;
The second parameter is the title of the short message;
The third parameter is the text of the short message;
The fourth parameter is the UID of the user who sends the short message;
Note: When the first parameter $ toid is 0, the message type is public message, and $ fromid is 0, the message type is system message, and $ message is a parameter of the message content, HTML is not supported, but Discuz is supported! Code.

Slave --------------------------------------------------------------------------------------------------------------------------------

SendmailFunction: This function is used to send emails, provided that the emails in the forum system are successfully configured and can be normally sent.

Function prototype:

Sendmail ($ email_to, $ email_subject, $ email_message, $ email_from = '')

This function also has four parameters, the first three of which are mandatory and the last one is optional;
The first parameter is the email address of the user who receives the email;
The second parameter is the email title;
The third parameter is the body of the email;
The fourth is the email address for sending emails;
Note: The fourth parameter is the email address used to send the email. optional. if it is left blank by default, the email is sent by the system;
This function is not often used to send emails. it can be used to create special functions based on your special needs. for example, it can be used to wake up emails without logon for N days;
Bytes --------------------------------------------------------------------------------------------------
$ MYSQL functions of the db object:
These MYSQL-related functions are difficult for junior webmasters because they involve some knowledge about php. if you do not know these functions, use them with caution;
The following describes the most common SQL statement execution functions: $ db-> query ($ SQL );
$ Db-> query ($ SQL), usually only one parameter is specified, that is, an SQL statement, for example:

$ Db-> query ("SELECT * FROM cdb_mytable ");

In this way, the SELECT * FROM cdb_mytable SQL statement is executed.
For other related functions, refer to include/db _Mysql. Class. php file.
Bytes --------------------------------------------------------------------------------------
Common JS functions used in the template:

ShowPrompt () function:
Function effect: A nice tip like a point change reminder;

Function example:

[Click here to see what the effect is]

Function explanation: For this function we need, you only need to care about the last two parameters. Obviously, the "haha" parameter indicates the information content, "2000" indicates the time for the message to stay, in milliseconds!
Function effect demonstration:

Bytes --------------------------------------------------------------------------------------------------

ShowDialog function: Used to pop up the prompt window

Function prototype:

ShowDialog (msg, mode, t, func, cover)

First parameter: content of the prompt information in the pop-up window;
The second parameter indicates the window type. optional values include info, notice, alert, and confirm. for details about the differences, see:

The third parameter is the title of the pop-up window;
The fourth parameter is the function executed after you click "OK". it is optional and can be used as needed;
Fifth parameter: whether to include a mask layer (that is, whether the background page becomes unavailable after the pop-up window), 0 is not a mask, and 1 is a mask;

Function example:

Click to see

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.