Directory & Path Implementation
This example shows how to implement a simple Yellow Pages application that consists of a Path, Directory and a Grid.
Navigate to the 'Software' category (Computers and Internet -> Software ) to view the corresponding Yellow Pages entries.
Steps to recreate
- 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.
- 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.
- 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.
- To improve the Directory layout, set the Directory's No. of Columns property to 2 and No. of Subcategories property to 4.
- 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.
- Add the appropriate programming code to the Directory's Before Show event or copy it from the provided example.
- Add the appropriate programming code to the Grid's Before Show event or copy it from the provided example.
- Make cosmetic changes as needed by modifying the text and captions within the HTML.
Database Tables used
Tables: directory_categories, directory_items, states
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.