Changes between Version 1 and Version 2 of Training/Section02

Show
Ignore:
Timestamp:
12/29/09 20:35:56 (16 years ago)
Author:
cfgrok (IP: 64.30.223.5)
Comment:

Converted unordered lists to ordered lists -- standardized header usage

Legend:

Unmodified
Added
Removed
Modified
  • Training/Section02

    v1 v2  
    1111Click on the This Template link and our template will display in your browser. This template can be portioned off into 6 sections: 
    1212 
    13  * Navigation – Contains the logo and the navigation 
    14  * Primary Content – Contains the general content for the user 
    15  * Secondary Content – Contains any secondary content in a 2 column format 
    16  * Footer – Contains footer content 
    17  * Message Box – Contains messaging to notify the user of status or error conditions 
    18  * Master Page – Contains the general page layout structure and includes the above 4 elements. 
     13 1. Navigation – Contains the logo and the navigation 
     14 2. Primary Content – Contains the general content for the user 
     15 3. Secondary Content – Contains any secondary content in a 2 column format 
     16 4. Footer – Contains footer content 
     17 5. Message Box – Contains messaging to notify the user of status or error conditions 
     18 6. Master Page – Contains the general page layout structure and includes the above 4 elements. 
    1919 
    2020[[Image(training02-1.png, nolink)]][[BR]] 
    2121'' The above diagram shows the content sections and the file in which each will reside '' 
    2222 
    23 === Making the Modules === 
    24  
    25  * Open the file /template.html and review the contents. Each section has been marked out for you with HTML comments. For example, the following section of code indicates the boundaries for the specific content. 
    26  * Create a new file using the name indicated (views/layout/Layout.Navigation.cfm) and copy the content in between the comments into the newly created file. Do this for each section. 
     23== Making the Modules == 
     24 
     25 1. Open the file /template.html and review the contents. Each section has been marked out for you with HTML comments. For example, the following section of code indicates the boundaries for the specific content. 
     26 2. Create a new file using the name indicated (views/layout/Layout.Navigation.cfm) and copy the content in between the comments into the newly created file. Do this for each section. 
    2727 
    2828'' Example of the boundaries for specific content '' 
     
    4040}}} 
    4141 
    42 === One Master to Rule Them All === 
     42== One Master to Rule Them All == 
    4343 
    4444Open /PlantOMatic/views/layout/Master.Layout.cfm and review the code. Master.Layout.cfm contains !ColdFusion and HTML source code and represents the high level structure of our application – it is primarily in charge of assembling our content modules. We get our content from the !ViewCollection and output it on the screen. The calls to the !ViewCollection are together at the top of the file: 
     
    6565}}} 
    6666 
    67 === Putting it all Together === 
     67== Putting it all Together == 
    6868 
    6969Our last task in skinning is to create a reusable mechanism to use our layout. Model-Glue 3 introduces the concept of an Event Type. Much like Types in Object Oriented Programming, an Event Type contains specific behavior and is addressable by a specific name. Event Types in Model-Glue can contain behavior that is executed BEFORE, AFTER or BEFORE and AFTER an Event is executed.  
     
    112112}}} 
    113113 
    114 === A Flexible One Column Template === 
     114== A Flexible One Column Template == 
    115115 
    116116Now, when we run our application at [http://localhost/PlantOMatic/ http://localhost/PlantOMatic/] we see our template in action: 
     
    119119'' One Column Layout '' 
    120120 
    121 ==== What about Two Columns? ==== 
     121== What about Two Columns? == 
    122122 
    123123To see the benefits of this flexible template, let's add a piece of secondary content. Open /PlantOMatic/config/ModelGlue.xml and update the default Event Handler to have an include for secondary: 
     
    136136Now when our Event Handler runs, Model-Glue will include the secondary content inside of the ViewCollection. Since we test for the existence of secondary in /PlantOMatic/views/layout/Master.Layout.cfm and adjust the HTML markup accordingly, the simple presence or the absence of secondary in the ViewCollection will turn our layout from a single column to a two column layout seamlessly. 
    137137 
    138 === A Flexible Two Column Template === 
     138== A Flexible Two Column Template == 
    139139 
    140140[[Image(training02-3.png, nolink)]][[BR]] 
    141141'' Two Column Layout '' 
    142142 
    143 ==== Housekeeping ==== 
     143== Housekeeping == 
    144144 
    145145We have a few items to take care of before we move on. 
    146146 
    147  * Open /PlantOMatic/views/layout/Layout.Navigation.cfm and replace the content: 
     147 1. Open /PlantOMatic/views/layout/Layout.Navigation.cfm and replace the content: 
    148148 
    149149{{{ 
     
    162162}}} 
    163163 
    164  * Open /PlantOMatic/views/layout/Layout.MessageBox.cfm and replace the content: 
     164 2. Open /PlantOMatic/views/layout/Layout.MessageBox.cfm and replace the content: 
    165165 
    166166{{{ 
     
    185185}}} 
    186186 
    187 === Section 2 Summary === 
     187== Section 2 Summary == 
    188188 
    189189In this section, we learned how to skin a static template, work with the Model-Glue framework to create a flexible layout and configure our Event Handlers for templating. For more information, we suggest the following documentation: