Create a guestbook with DreamweaverMX (3)
Author:Eve Cole
Update Time:2009-05-31 21:07:14
OK, the next step is the email and homepage address, which are slightly different from the previous method, as shown in Figures (7-18) and (7-19).
7-18
7-19
Similarly, please note that there is a sequence. First select the picture of the mailbox, and then click the Link button from the properties panel below. The dialog box shown in Figure (7-20) appears, which means where to connect if you click on this picture.
7-20
In the past, our function was to connect to a local page, but in DW MX we can connect to a dynamic page by selecting Data Sources. Here we take the email field from the record set and remember to add "mailto:" in front. Why do we add this here? It's because this "mailto" is an html tag, that is, the connection is opened with OUTLOOK to send the mail.
At the same time, remember to add the alt attribute to this email image, that is, the email address of alt="<%=(guestbook.fields.item("f_name").value)%> is <%=(guestbook.fields.item(" f_email").value)%>, click here to send him/her an email".
The connection method of the home page address is shown in Figure (7-21).
7-21
After binding the connection, remember to add the alt attribute to the image. Change it to alt="<%=(guestbook.fields.item("f_name").value)%>. The email address is <%=(guestbook.fields.item( "f_homepage").value)%>, click here to send him/her a message"
Yes, it's a bit boring here, but come on, victory is waving at us. :)
Take a look at the current effect, as shown in Figure (7-22).
7-22
The next thing to do is to add links to reply to the topic, edit, and delete, and make it dynamic. The server behavior used here is to jump to the details page (Go To Detail Page). Previously we established the reply page (rep.asp), edit page (edit.asp) and delete page (del.asp). Here we will not detail how to connect one by one. The effect is as shown in the figure (7-23 , 7-24, 7-25).
7-23
7-24
7-25
After completing the above three steps, you still need to remember to do one thing. What if we have many messages? ? Here we need to use the Repeat Region (repeat region) in the DW MX server behavior, select the entire large table that displays the message, Application-->Server Behaviors-->Repeat Region, as shown in Figure (7-26).
7-26
We define it to display 14 records per page, which looks a little simpler, and click the OK button.
When reaching this step, I have to consider a question. How do browsing users know how many message records I have? ? In fact, when we create the record set, DW MX has already considered this for us, as shown in Figure (7-27).
7-27
First record index: The first record in the index.
Last record index: The last record in the index.
total records: the sum of all records.
With these, all we have to do is drag them onto the page and add corresponding explanatory text, as shown in Figure (7-28).
7-28
If you persist, you will succeed! We also need a guide bar because we used the Repeat Region earlier, as shown in Figure (7-29).
7-29
Insert-->Application Objects-->Recordset Navigation Bar (Insert-->Application Objects-->Recordset Navigation Bar), after clicking, a dialog box as shown in Figure (7-30) will appear.
7-30
Recordset: Select the record set to be navigated here.
Display Using: Select the display method of the navigation bar here, text is text, images is picture, here we choose images.
Click the OK button, and the display effect is as shown in Figure (7-31).
7-31
Maybe it is too big. We can shrink this table. After selecting this table, change its width="50%" to width="15%" in the properties panel. The final effect is as shown in the figure (7-32 ) shown.
7-32
Now for the final improvement stage, connect "Publish a new topic" to the new.asp page, connect the following "Admin Portal" to the login.asp page, and use a server behavior on "Logout!" This function is actually for Super Prepared by the user. As shown in Figure (7-33).
7-33
User Authentication: User authentication.
Log Out user: The logged in user logs out.
After clicking, a dialog box as shown in Figure (7-44) appears.
7-44
Log Out When: Which way to log out, Link clicked: Log out when this link is clicked. Page Loads: Exit when the page is closed.
When Done, Go To: Which page to go to after exiting, here we define to go to the index.asp homepage.
Also, the {Session.MM_username} seen above is actually prepared for super users. When you are not logged in, it will display "Welcome". If a super user is logged in, it will display "Welcome XX!". Here we need to create a Session variable, as shown in Figure (7-34). As for the issue of this Session variable, we will introduce it in detail in the following chapters. :)
7-34
7-35
After clicking, a dialog box as shown in Figure (7-35) will appear. Enter MM_username in the dialog box. This MM_username variable is automatically generated by DW MX after applying the login server behavior (we will introduce it in detail later). Also drag it before the exclamation point between "Welcome!" Ah, let's roar together~~~~~~Finally finished the most difficult part, congratulations, hehe...