DREAMWEAVERMX to create a message (ii)

Source: Internet
Author: User
Tags bind empty final range dreamweaver
Dreamweaver in front of us, we have to ensure that the normal message display will be done in the message, if there is no message will show "no message", that these in the DW MX How to do?? Here, we're going to learn a new server behavior show region (display area), that is, according to the data in the library to display different information.

First of all, the basic concept of it, take our message content to make an analogy: if my message content is empty, then show what, if the message content is not empty, then show what. As shown in figure (7-9).

7-9

After selecting the entire Message content table, use the Application-->server behaviors-->show region-->show Region If the IF Recordset is not Empty (when the recordset is not empty), This is the form that is displayed when the message content is not empty. Speaking of this, we have to talk about several other server behaviors.

Show Region if the If Recordset is Empty (if the Recordset is empty): Displays the selected range when the recordset is empty.
Show Region if the Recordset is not Empty (if the recordset is not empty): Displays the selected area when the recordset contains records.

Show Region if the first record, if it is the same: Displays the selected area when you are in the first record in the recordset.
Show Region if is not the first record (if it is not one): Displays the selected range when it is not in the first record in the recordset.
Show Region if the last record (if final): Displays the selected area when the last record in the recordset is displayed.
Show Region if not the last record (if it is not final): Displays the selected range when the last record in the Recordset is not present.

Click it to appear in the dialog box shown in figure (7-10).



7-10

In this dialog box, select the recordset that corresponds to this behavior, and on this page we have only set up a recordset with the name Guestbook. The effect after applying the server behavior is shown in figure (7-11).



7-11
In order to prevent mistakes when there is no message content, here we also use show Region if the Recordset is Empty (when the recordset is empty) behavior, apply it to the "no message" table, the final effect as shown in figure (7-12).



7-12

Next, let's refine it by inserting some small tables into the large table showing the messages, arranging them, and inserting the relevant pictures (here is the most common small picture on the web.) :), as shown in figure (7-13). Here are some of the most basic Dreamweaver forms Kung Fu, details of the other chapters of this series of tutorials.



7-13

The thing to do now is to drag the data from the database into the table, if you drag the user name to the cell behind the name, the message content to be placed in the post content of the cell, remember to F_name dragged to publish in front, F_time dragged to the back, so that when the show became "xx published in XX ”。 See figure (7-14) below.



7-14

Here is a small bug, that is, the message we display can not be formatted, that is, you will find in your message no matter how many carriage returns, the display will not wrap, and more than two spaces will become a space. This problem can be solved by using the SPDFORMAT.MXT plugin (click here to download the plugin!) )。 After installing the plugin, the method is shown in figure (7-48). Message content and webmaster reply to use this plugin.




7-48
Maybe another person to ask, that my database of those oicq and so how to do ah. This, do not know that you do not know the HTML img tag an ALT attribute, that is, when the mouse moved up to display the corresponding text. Here, we have the corresponding dynamic binding to the picture. As for the home page address is made after the click of the link to the corresponding address on the line, the mailbox click on the open Outlook on the message to the letter.

The specific aspects are shown in figure (7-15).



7-15

Here is a sequence of points, first select the Oicq picture, and then from the right of the recordset to select the appropriate data set (here, select the database to store the OICQ number of fields (F_OICQ), and then from bind to: Select Img.alt in the dropdown menu, which is the IMG tag attribute we talked about earlier, then click Bind on the back, and if the binding is correct, it will produce the same color as the previous recordset to indicate that a server behavior is applied here, as shown in figure (7-16). Here we have to beautify it.



7-16

Open source and Design view, you will find just inserted in the code is alt= "<%= (Guestbook.fields.item (" F_oicq). Value)%> ", copy this code put it in front of it, and put the f_ OICQ is changed to F_name (the name field of the sender in the database) so that its final code is alt= "<%= (Guestbook.fields.item (" F_name "). Value)%> The OICQ number is <%= ( Guestbook.fields.item ("F_oicq"). Value)%> ", so that when it is displayed as" xx oicq number is XX ", are dynamically bound, how good ah, oh.



7-17

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.