Weiphp WeChat development tutorial message board plug-in development details

Source: Internet
Author: User
Detailed description of message board plug-in development in weiphp development tutorial based on weiphp framework

Detailed description of message board plug-in development in weiphp development tutorial based on weiphp framework


1. function analysis

The traditional message board should have functions such as publishing messages, viewing messages, replying messages, and managing messages. this tutorial develops the most basic message board, which only includes publishing messages and viewing messages, the foreground page style created by using bootstrap is as follows:

3. view the code structure

After the plug-in is created, the weiphp framework will automatically generate a plug-in folder under the Addons Directory. in this tutorial, a liuyanban folder is generated. the liuyanban directory contains three folders: Controller, Model, and View, and config. php, LiuyanbanAddon. class. php files. The Controller generally writes logic processing code, including data insertion, data query, and other functional code. The Model mainly writes code for interaction, and the View contains the foreground template. Config. php is the configuration file, and LiuyanbanAddon. class. php is the plug-in information file, which generally does not need to be modified.

. After modifying the hreflink address, click "Publish>" in the top-right corner of index.html to go to the message Publishing page.

Open the weiphp background management page and create a new liuyanban data model. The model shown below is liuyan_info. we recommend that you change it to liuyanban because only the data model name is liuyanban (the same as the plug-in name, data can only be displayed in the default weiphp message board management list. how to change the default data display page is not within the scope described in this tutorial, therefore, you should write the data model identifier as liuyanban.

8. query user information

Open Controller/LiuyanbanController. class. php: write 16, 17, and 18 lines of code in the liuyan () method, and query User information based on the user's uid, and output the information to the name of the contact person on the message Publishing page. The purpose of this operation is to facilitate user operations. as long as the personal information is bound once, you do not need to enter the name again when leaving a message.

Use thinkphp template label in index.html Output messages cyclically. BTW: weiphp is developed based on thinkphp. all thinkphp labels are available in weiphp, therefore, the key to learning weiphp plug-in development is to understand basic thinkphp knowledge.

So far, the development of the weiphp message board plug-in has been completed. to view the plug-in effect, please reply to the "message board" on the public platform of "Aidan paradise". As for how to package and download the plug-in, upload it to the new weiphp framework or export the data model. Please check the official weiphp documentation on your own.

The above is the detailed description of weiphp development tutorial message board plug-in development. For more information, see other related articles on php Chinese network!

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.