Dedecms plugin development tutorial and dedecms plugin tutorial
This is a simple plug-in instance. With this plug-in, you can know how to develop a plug-in, how to set its structure, database, background, and so on.
File structure:
The enroll. php file is in the plus file.
The enroll.htm file is in the templets/plus folder.
The adenroll. php file is in the dede folder.
Under the dede/templet folder of the adenroll.html File
SQL file:
Create table if not exists 'dede _ enroll' ('id' int (4) not null auto_increment, 'name' varchar (20) not null, 'mail' varchar (30) not null, 'tag' tinyint (1) not null default '0', primary key ('id') ENGINE = InnoDB default charset = utf8 AUTO_INCREMENT = 1; insert into 'dede _ plus '('aid', 'plusname', 'menustring', 'mainurl', 'write', 'isshow ', 'filelist') VALUES (30, 'register online ',' <m: item name = ''register online ''' link ='' adenroll. php ''rank = ''plus _ register online ''' target = ''main''/> ', '', 'g1000', 1 ,'');
For convenience, I have set two fields, name and email tag, to indicate whether admission 1 is admission.
The first insert statement is added to the background management.
The second insert statement is added to the foreground navigation bar.
Enroll. php
<? Php // ******* must first contain common. inc. php then session_start (); otherwise, the session value cannot be obtained. // ******* because of common. inc. php configures the session path include_once dirname (_ FILE __). '. /.. /include/common. inc. php'; // contains the configuration file session_start (); require_once DEDEINC. "/arc. partview. class. php "; // contains the partiew class // ***** instantiate this class to obtain the header navigation bar and tail information. You can use dedetemplate if not required. class. php class $ pv = new PartView (); if ($ _ POST) {if (CheckEmail ($ _ POST ['mail']) = false) {// verify the mailbox The method is in common. func. php public function ShowMsg ('mailbox format error', '-1'); exit ();} if ($ _ POST ['name'] = "") {ShowMsg ('user name cannot be blank ','-1'); exit () ;}else {$ name = htmlspecialchars ($ _ POST ['name']);} if ($ _ SESSION ['dd _ ckstr']! = Strtolower ($ _ POST ['valider']) {// The verification code must be converted to lower-case ShowMsg ('verification code error',-1); exit ();} $ SQL = "insert into 'cms _ enroll' (name, mail) values ('$ name',' $ _ POST [mail] ')"; // ********* $ the dedesql can be automatically instantiated by the system directly. class. php $ affected = $ db-> ExecuteNoneQuery2 ($ SQL); // execute a statement to return the impact value if ($ affected) {ShowMsg ('registration successful ', -1) ;}} else {$ pv-> SetTemplet (DEDETEMPLATE. '/plus/enroll.htm'); // set the template $ pv-> Display (); // Display page}?>
Enroll.htm
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Adenroll.html
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
Is there a lightweight Forum plug-in for zhimeng? I haven't found myself on the Internet for a long time. I can't develop any thanks.
No. You can use dz for Forum integration. For problems with dream weaving, you can go to Baidu to search for the dream weaving administrator's house. There are many tutorials on dream weaving.
How to Develop dedecms plug-ins? How is the development process?
Dede help page. Bbs.dedecms.com/136294.html This page contains detailed instructions, you can download a product manual to have a look, the manual below is a secondary development. But it depends on how you develop it.