dreamweaver| Statistics | Site so far, doking ' s blog has been able to operate. But you can find that the left side of the navigation is still empty, the following sections mainly for the left side of the navigation menu to add features. This chapter focuses on adding site statistics to the left navigation.
9.1 Basic Page Design
Open the template dkblog.dwt.aspx and add the text design to the left navigation as shown in Figure 9-1.
Figure 9-1 Template dkblog.dwt.aspx left navigation text design
9.2 Online population statistics
The realization of online population statistics depends on Global.asax files. The Global.asax file includes program code that handles application-level events, just like the Global.asa file in classic ASP. The <script> tag in Global.asax contains an event handler that faces the application hierarchy. The first group of event handlers handles the start of the application and the Stop event. A start event is awakened when any page is requested for the first time. The application termination event is awakened when the application shuts down.
The establishment of Global.asax documents, generally succeeded in compiling. You can now quickly create Global.asax files in the visual Web Developer 2005 software.
(1) Download and install the visual Web Developer 2005.
Visual Web Developer 2005 Download Address:
http://go.microsoft.com/fwlink/?linkid=30092&clcid=0x409
After downloading installs, after running its welcome interface as shown in Figure 9-2.
Figure 9-2 Visual Web Developer 2005 Run Welcome interface
2 after the Visual Web Developer 2005 runs, select "File" → "New File", in the pop-up "New File" dialog box, expand the "Categories" Web option, and select "Visual Basic", select " "Global application Class" in Templates, as shown in Figure 9-3.
Figure 9-3 Newly established global application Class
(3) Click the "Open" button and make a new Glbal file as shown in Figure 9-4.
Figure 9-4 A newly created Glbal file
(4) Modify the Glbal file, as shown in Figure 9-5.
Figure 9-5 Modifying the Glbal file
(5) Save the Glbal file to the D:\dkkblog root directory, the file name is Glbal.asax.
(6) Return to Dreamweaver, open the template dkblog.dwt.aspx, and switch to Code view to find the code:
<TD class= "BTD" > site online statistics: People </td>
and read:
<TD class= "BTD" > site online Statistics: <%=application ("dk_uses")%> people </td>
(7) Save the template.
Reminder: This new software is powerful because it uses Visual Web Developer 2005 to create glball.asax files, just for the convenience of the reader and for the reader to touch the Visual Web Developer 2005. If you don't have visual Web Developer 2005, you can simply create a blank notepad and write the code shown in Figure 9-5 above, and save it as a Glball.asax file.
9.3 Statistics of site notes and replies
Recall that in the "7.1 User logon server Behavior", the user has been statistics for their notes and replies, site notes and responses to the statistics and similar.
(1) Open the template dkblog.dwt.aspx, create a new dataset ZDBJ, as shown in Figure 9-6, and set up a new dataset ZDHF, as shown in Figure 9-7.
Fig. 9-6 Setup diagram of DataSet ZDBJ
Fig. 9-7 Setup diagram of DataSet ZDHF
(2) Bind the dataset ZBBJ, data set ZBHF to the page, as shown in Figure 9-8.
Figure 9-8 Binding Data set ZBBJ, ZBHF
(3) Save the template dkblog.dwt.aspx and update all pages.