Creating Dynamic Menu items

CSS Menu Writer 2.0 allows you to easily create dynamic menu items that are created based on information in your database.

If you intend to include dynamic menu items in your menu, make sure you have completed the following steps before entering the CSS Menu Writer wizard.

  • Define your site in Dreamweaver, including Testing Server using PHP/MySQL as the server model.
  • Create a database connection within Dreamweaver for your current site.
Dynamic Menu

Connection: Choose the database connection you wish to use.

Define buttonClick the Connection Define button to load the database connection define window where you can define a new database connection.

Table: Choose the database table you wish to use.

Label: Choose the column from the selected database table that you wish to be displayed as the menu item.

Key column: Choose the key column for the specified database table.

Link: Enter the necessary path to the file your dynamic will navigate to.

Note: Typically, this link will consist of [filename] + ?[database column] where the database column you choose is the key column.

Add to formula: Click the Add icon to choose the database column that you wish to add to the end of the Link you have entered. Typically, this will be the key column (see screenshot).

Filtering and Sorting

You can apply a filter to your dynamic menu item to only create menu items for the desired contents.

Filter: Choose the database column that you wish to filter. Then, choose from one of the following options from the secondary menu list.

  • *Nested
  • URL Parameter
  • Form Variable
  • Cookie
  • Session Variable
  • Server Variable
  • Entered Value

*Nesting: The Nested option will only be available if the dynamic menu item you are creating is a sub-level menu item of an already created dynamic menu. The example at the bottom of this page describes a common use for this feature.

Sorting: Choose the column in your database table to sort by. Then, from the secondary menu list, choose whether to sort Ascending or Descending.

Dynamic Menus using Nesting Example

The CSS Menu Writer menu shown here contains a combination of static and dynamic menu items. Under the Products menu item are two sets of dynamic menu items.

CD and Gear are dynamically created menu items from the Item Category database table. The products displayed in the 3rd level menu items are dynamically generated from the Items database table, and are filtered using the Nested option to filter by the Category ID from the parent menu item.