Dnt2.0 dating information plug-in creation full strategy (2)

Source: Internet
Author: User

7. Create a userpersoninfo. ASPX page in the discuz. Web project, write the corresponding logic, and complete the member's personal information modification function to meet the needs of the first two points in [2.
1. Create the userpersoninfo. ASPX page in \ aspx \ 1 to generate the corresponding. CS file.

2. Add the rendering logic in the userpersoninfo. aspx. CS file. For the specific code, see the attachment. Note that there is no need to write anything on the userpersoninfo. ASPX page at this time, because it will be replaced after the template is generated.

Code: Code
/// <Summary>
/// Current user information
/// </Summary>
Public userinfo user = new userinfo ();

Public personinfo person;
Public datatable personality;
Public datatable describing;
Public datatable predominance;
Public datatable Fond;

Protected override void showpage ()
{
Pagetitle = "User Control Panel ";

If (userid =-1)
{
Adderrline ("You have not logged on ");

Return;
}
User = users. getuserinfo (userid );

Person = personinfo. GetModel (userid );
Personality = personinfo. getenum

(Personinfo. personinfotype. Personality );
Describing = personinfo. getenum

(Personinfo. personinfotype. Describing );
Predominance = personinfo. getenum

(Personinfo. personinfotype. predominance );
Fond = personinfo. getenum (personinfo. personinfotype. Fond );
}

3. Copy usercpprofile.htm in \ Templates \ defaultand change it to userpersoninfo.htm. Then, modify it to the expected performance, as shown in the "Edit personal information" figure. The logic of the token is also written in .htm. For specific rules, refer to "discuz! NT 2.0 template Description document. chm ".
The following code is used to display a large number of check boxes, which is difficult to create this template page.

Code:

Code
<Label for = "personality">

Sex: </label>
<Div style = "width: 100%">
<% Loop personalityitem

Personality %>
<Div style = "width: 150px;

Float: Left; "> <input name =" personality "type =" checkbox "value =" {personalityitem

[Personalityitem_text]}"
<% CSHARP %>
If

("{Person. Personality}"). indexof ("{personalityitem [personalityitem_text]}")! =

-1)
{
Templatebuilder. append ("

Checked = 'checked '");
}
<%/CSHARP %>
/> {Personalityitem

[Personalityitem_text]} </div>
<%/Loop %>
</Div>
<Br/>

4. Add the updated personinfo logic in the userpersoninfo. aspx. CS file. For the specific code, see the attachment. Code: Code
If (dntrequest. ispost ())
{
If (forumutils. iscrosssitepost ())
{
Adderrline ("your request is incorrect and cannot be submitted. If you have installed a personal firewall software (such as Norton Internet Security) That is blocked by default, do not disable it and try again. ");
Return;
}

If (page_err = 0)
{
Person. lookfor = dntrequest. getint ("lookfor", 0 );
Person. Title = dntrequest. getstring ("title ");
Person. Intro = dntrequest. getstring ("Intro ");
Person. Height = dntrequest. getstring ("height ");
Person. stature = dntrequest. getstring ("stature ");
Person. marriagestate = dntrequest. getstring ("marriagestate ");
Person. Industry = dntrequest. getstring ("industry ");
Person. Job = dntrequest. getstring ("job ");
Person. constellation = dntrequest. getstring ("constellation ");
Person. Blood = dntrequest. getstring ("blood ");
Person. edulevel = dntrequest. getstring ("edulevel ");
Person. School = dntrequest. getstring ("school ");
Person. Earning = dntrequest. getstring ("Earning ");
Person. Personality = dntrequest. getstring ("personality ");
Person. Describing = dntrequest. getstring ("describing ");
Person. predominance = dntrequest. getstring ("predominance ");
Person. fond = dntrequest. getstring ("fond ");
Personinfo. updatemodel (person );

Seturl ("userpersoninfo. aspx ");
Setmetarefresh ();
Setshowbacklink (true );
Addmsgline ("modifying personal information completed ");
}
}

5. Compile the discuz.webproject and generate the userpersoninfo.htm template in the background. At this time, the "Edit personal information" page is basically complete, and the functions can meet the requirements.

 8. the above functions are basically completed, but they cannot be entered on the "Edit personal information" page because there is no corresponding menu. Modify the menu template below to add the menu and the corresponding logic.
1. Modify _permenu.htm and add the "Edit personal information" link.

2. Modify _menu.htm and add the "Edit personal information" link.

3. How to place menus? This is simple. The template is generated, and the entire dating plug-in is modified and created.

IX. Summary
1. The disadvantage of this modification method is that the source code must be required, and it is difficult to modify the template.

2. The advantage is that it is closely integrated with source files,Excellent front-end performance, seamlessly integrated with the ForumThere is no flaw. It is in line with the official development ideas.

3. Some templates have been modified. To change the skin, you must overwrite the five modified templates each time.

4. Replace two new DLL files: discuz. Web. dll and discuz. plugin. Friend. dll.

5,In this way, the member information of dnt2.0 can be greatly expanded. For website integration, dnt2.0 members can be used as the core to add more business functions to it, or cross-cutting with the Business Process of the website, resulting in great flexibility.I want to use this method to modify dnt2.0. Using dnt2.0 for website integration and restructuring is not a problem.

(Full text)

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.