Error: Failed to load processor TOC
No macro or processor named 'TOC' found

Section 4: Request Formats Are Your Friend

Model-Glue makes it easy to reuse your logic and your content across different media and display formats.

  1. In the PlantOMatic application, first click on the Display link:
    Training 04 Image 1
  2. Then click the Print Friendly View link:
    Training 04 Image 2

Exercise: Request Format

Notice how a pop up window loads with the same user experience inside? We've pre-made the JavaScript pop up window for you, but we can't call it a print friendly view just yet. Look at all that black ink we'll be wasting! Let's use a request format to exclude the navigation, footer and other extraneous content.

  1. Open /PlantOMatic/views/Display.Shipment.cfm and find the line for Print Friendly View. The current link looks like this:
<tr>
  <th colspan="6">
    <a href="#linkPrint#" onclick="return popPrintWindow( this.href );">[ Print Friendly View ]</a>
  </th>
</tr>

  1. We will now add in a request format URL parameter to the link. Append the following to the link:
&requestformat=print

  1. Next, open /PlantOMatic/config/ModelGlue.xml and find <event-types>. Add a new attribute to the <views> tag called format and assign the value of html.
<views format="html"> 

Putting It All Together

Let's test our new functionality by reloading your application and clicking the Print Friendly View once again. See how the pop up window only contains the primary content (see figure below)? We excluded the Navigation, Footer and Master.Layout.cfm content through the use of the requestformat URL parameter and format attribute on our templatedPage Event Type.

Training 04 Image 3
Print Friendly View

More Information

For more information about Model-Glue Request Formats, review the following documentation:

How To Use Formats


Back: Training Section 3: Dealing with Data

Next: Training Section 5: Mother's Little Helper

Attachments