Create a login nugget

In this tutorial topic you will create a page that will be shown as a nugget in the site's main page. The page will display some menu options for the users that are already logged in, or the login form for the users that are not logged in yet.

To create this page, you will use the Show If User Is Logged In conditional region, with the else option enabled. This will allow displaying a region if the user is logged in, and another if he isn't. Follow the next steps to create the page:

  1. First open the login.php file in Dreamweaver.

  2. Type in the menu options that the user will have one by one, and also turn them into links, as explained below:
    · Post Ad - link to index.php?act=post
    · Logout - no link.

  3. Next you will turn the logout text into an actual logout link. Select the text and apply the Logout User server behavior from Server Behaviors > MX Kollection > User Login.

    Note:
    Before applying this server behavior, make sure you have the login settings correctly configured.

    The configuration is straightforward, as you can see below:


     

  4. Once you're done with the Logout User dialog box, click the OK button to apply the server behavior.

  5. Now select the entire page contents (the two links) and apply the Show If User Is Logged In server behavior from the Server Behaviors tab -> MX Kollection -> Conditional regions. Configure it as shown below:


     

  6. This will determine if the user is logged in based on the user name and the password, and also has an else region. The else region contents are displayed when the user is not logged in.

  7. Now the Dreamweaver page looks like the following:


     

  8. To add the login form, select the text after the {else} mark-up: Else text: Replace this. Apply the User Login Form Wizard from the MX Kollection tab of the Insert bar, and configure it similar to the User Authentication login page. It will automatically add the login form into the page. Once completed, the nugget page will look like the following in Dreamweaver:


     

  9. Save the page and upload it to the server. This was the last piece needed in order to create the site's main page.

In the next topic of the tutorial, you will assemble all the pages you've created so far into a single page, the site's main index.