9 Posting an Article in the Blog

  • Upload
    tud-bar

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

  • 7/23/2019 9 Posting an Article in the Blog

    1/4

    Posting an Article in the Blog

    For publishing articles to your blog, you have created the post.php page, which contains a record

    insertion form.

    1. Open the post.php page.

    2. Apply the blgtemplate to it.

    3. In the title field of the ocument bar, enter Blog: Post Article as the title of the page.!. "lic# inside the maineditable region.$. "lic# the Application tab from the Insert bar and select %ecord Insertion Form &i'ard from the

    Insert %ecord button bar.

    (. "onfigure the %ecord Insertion Form as listed below and shown in Figure 23.

    Figure 23.)he %ecord Insertion form

    *+ -iew larger

    se the defined database connection.

    /elect the table that you want the record inserted into0 blg_article_art

    /elect the page to redirect users to after the insertion0 index.php.

    ou need to remove the id_artfield, because this is auto incremented each time a record is

    inserted in the table. )o remove a field, select it and clic# the inus * button.

    Also, remove the idtop_artfield. /elect the topic from a popup menu that you will create

    later. For each of the remaining fields, enter a label, as seen in the screen shot.

    "hange the description_artand text_artfields to display as te4t areas, because you need

    to insert a larger amount of te4t into these fields.

    "hange the date_artfield to display as a hidden field, and set its default value to0

    )his way, you don5t have to manually specify the value of the date_artfield. )he server will

    automatically populate it with the current date and time.

    http://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1/figure23_lg.htmlhttp://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1/figure23_lg.htmlhttp://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1/figure23_lg.html
  • 7/23/2019 9 Posting an Article in the Blog

    2/4

    Note:)he date( )function is a special 676 function that returns the current local date and time, in thespecified format. )he echofunction is another 676 function that outputs its parameters8in this case,

    the results of the date function.

    "lic# O9 to e4it the %ecord Insertion &i'ard and insert the form on the page.

    Figure 2! shows how the form should appear in esign view0

    Figure 24.)he record insertion form in esign -iew

    *+ -iew larger

    )here5s only one problem with this form0 you cannot select the topic to which the article belongs. :utwhy then have I removed the idtop_artfield from the form; &asn5t that necessary to specify the

    topic. Indeed, idtop_artis used to identify the topic to which a certain article belongs. 7owever, this

    is only a numeric field and it would be a daunting tas# to guess what number a certain topic has andthen write that number in a te4t field. Instead, you should be able to select the topic name from a

    dynamic popup menu.

    A dynamic popup menu displays a set of record fields from a recordset and allows you to select one./hould the database be modified, the dynamic menu changes accordingly, without reist?enu button from the Forms tab of

    the Insert bar.

    !. /elect the menu and label it idtop_artin the 6roperty inspector.

    $. "lic# the ynamic button from the 6roperty inspector and configure the ynamic enu dialogbo4 as shown in Figure 2$.

    http://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1/figure24_lg.htmlhttp://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1/figure24_lg.htmlhttp://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1/figure24_lg.html
  • 7/23/2019 9 Posting an Article in the Blog

    3/4

    o ou will use the options from the rsenu recordset.

    o )he submitted value is id_top, but the actual entries in the popup menu are the names

    of the topics specified by title_top.

    Figure 2.)he ynamic >ist?enu dialog bo4

    (. "lic# O9.

    @e4t, update your form to include the newly created dynamic menu0

    1. o to the /erver :ehaviors tab in the Application panel.

    2. oubleclic# the Insert %ecord server behavior.3. In the list of columns, you can see that the idart_topdoes not get any value. /elect this

    column and set its value to that of the idart_topform field.

    http://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1/figure26_lg.html
  • 7/23/2019 9 Posting an Article in the Blog

    4/4

    Figure 2!.)he Insert %ecord dialog bo4

    *+ -iew larger

    !. "lic# O9.

    )he insert form is now ready for action. 6review it in the browser by pressing F12 and see how it

    wor#s.

    Figure 2".)he insert article form

    *+ -iew larger

    our application is ready. ou have set up a basic blog, where you can post articles and visitors canread them. :ut it doesn5t loo# very appealing, does it; ou need to add some "// touch to your blog to

    ma#e it more lively. In the ne4t section, you will learn how to do that.

    http://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1/figure26_lg.htmlhttp://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1/figure27_lg.htmlhttp://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1/figure27_lg.htmlhttp://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1/figure26_lg.htmlhttp://www.macromedia.com/devnet/mx/dreamweaver/articles/php_blog1/figure27_lg.html