Main page

Directory & Path Implementation

Description

This example shows how to implement a simple Yellow Pages application that consists of a Path, Directory and a Grid.

Usage

Navigate to the 'Software' category (Computers and Internet -> Software ) to view the corresponding Yellow Pages entries.

Steps to recreate

  1. Use the Directory Builder to create the yp_categories Directory and Path components based on the directory_categories table which is located in the Internet database. In the 2nd step of the Builder, leave the Root Category identifier field empty.
  2. Use the Grid Builder to create the yp_grid Grid that shows the Yellow Pages listings.
    On the 2nd step of the Builder use the Build Query option to select 3 tables: directory_items, states and directory_categories, then select the desired fields from the directory_items table plus the state_name field from the states table and the category_name field from the directory_categories table.
  3. To make the email and url fields “clickable”, change the Label control to a Link control, then under the Format tab of the Properties window, set its href property to “mailto:”. Then switch to the Data tab of the Properties window and set the Href Type property to Database, its Href Source property to email and set its Preserve Parameters property to None.
    Similarly, change the Label control to a Link control, set its Href Type property to Database, its Href Source property to url and set its Preserve Parameters property to None.
  4. To improve the Directory layout, set the Directory's No. of Columns property to 2 and No. of Subcategories property to 4.
  5. To allow the Grid to utilize the category selected during the directory browsing, add the following Where parameter: directory_items.category_id equals(=) category_id into the Grid's Data Source property.
  6. Add the appropriate programming code to the Directory's Before Show event or copy it from the provided example.
  7. Add the appropriate programming code to the Grid's Before Show event or copy it from the provided example.
  8. Make cosmetic changes as needed by modifying the text and captions within the HTML.

Database Tables used

Database: Internet

Tables: directory_categories, directory_items, states

Events Used

Grid's Before Show event - used to hide the Grid when no matching records are found.

Directory's Before Show event - used to hide the whole Directory when the user reaches the lowest Directory level and no more subcategories are found.