Documentation > Tutorial > 7.2 Entry list page: List testing and view template customization
7.2 Entry list page: List testing and view template customization
Go back to browser's window/tab for mygb application and open/refresh the "List Entry" main link page. All previous entries might be listed as below.
The above design layout displays the items of the list by using traditional spreadsheet row and column style. The column names of the list are directly mapped from the table field names. In the context of guestbook application, the list is targeted to be viewed as a simple list of public comments and should not make the visitors feel like they are using an online database administration tool. Need to change the design layout to make the list looks more natural to the visitors. Open the template file that is currently used as a default view layout of the list (E:\wmbase\public_html\cgi-bin\webman\mygb\mygb_entry_list.html) and below is the part of the content which utilizes HTML table to structure the main layout of the list.
Inside the above table structure the content is further splitted into two sub-content which identified as MENU template-element named caption (lines 17-24) and LIST template-element named main (lines 33-42). Read the framework's view template documentation to understand how the view template content is generally constructed to be used by the framework's component-type modules. Also read the documentation on webman_db_item_view_dynamic module especially at the view template sub-section for more specific descriptions on how view template layout for the list should be structured. Do remember that the module ("mygb_entry_list") that is used to display the list is generated based on this particular component-type module ("webman_db_item_view_dynamic"). Below is the new proposed view template layout structure of the list.
14 ... 15 <!-- start_menu_ name=caption //--> 16 <b>Order by:</b> menu_item0_ | menu_item1_ | menu_item3_ 17 <!-- end_menu_ //--> 18 <p /> 19 20 <table border="1" width="480"> 21 <!-- start_list_ name=main //--> 22 <tr> 23 <td> 24 $tld_nickname_ [$tld_email_] said... 25 <p /> 26 $tld_entry_ 27 <p /> 28 <b>Posted at:</b> $tld_wmf_date_created_ / $tld_wmf_time_created_ 29 <p /> 30 </td> 31 </tr> 32 <!-- end_list_ //--> 33 </table> 34 ...
The proposed modifications make the layout structure more simple but still follow the generic structure defined by the framework. The caption part has been moved out from the table structure (line 16) and reduced to only 3 caption names that would be displayed (caption names number 1, 2, and 4). The field part still remains inside the table structure (lines 22-31) but the viewed items are placed together into single column. Apply the proposed modifications and save it as new view template file named mygb_entry_list_customize.html. Go back to ADT's Link Structure/Reference page section and set the "template_default" parameter name setting for "mygb_entry_list" module reference as shown below.
In the previous setting there is no specific view template file has been assigned to "mygb_entry_list" module. Following framework's CoC the module will use the default one (mygb_entry_list.html). This new setting will make the module ignore framework's CoC implementation and use mygb_entry_list_customize.html file as its view template. Click the "Set" button to save this new view template setting of "mygb_entry_list" module. Still at the ADT's Link Structure/Reference page section of "mygb_entry_list" module, change the setting for "order_field_caption" parameter value using new string entry as below:
The "order_field_caption" parameter holds string value that represents the captions of fields separated by ":" characters. The new string value assigned was to change the caption "Wmf Date Created" to "Date/Time Posted". It also remove the "Wmf Time Created" caption thus reduce the field number from 4 to 3. This is done so the available captions were inline with the content structure of the new view template: mygb_entry_list_customize.html. Following this new caption setting the "order_field_name" and "map_caption_field" parameters should also be changed as follows:
Click the "Set" button to apply the changes made above and below is the new parameter settings of "mygb_entry_list" module's reference that should be displayed by the browser.
Go back to browser's window/tab for mygb application and open/refresh the "List Entry" main link page. The list should now be displayed in more natural ways with less administrative looks and feels as shown below.
|Copyright © 2012 - 2017, Mohd Razak Samingan, Faculty of Computing, Universiti Teknologi Malaysia.|