[[TOC(heading=Training Section Contents, Training*)]]
= 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:[[BR]]
[[Image(training04-1.png, nolink)]]
1. Then click the Print Friendly View link:[[BR]]
[[Image(training04-2.png, nolink)]]
== 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:
{{{
|
[ Print Friendly View ]
|
}}}
2. We will now add in a request format URL parameter to the link. Append the following to the link:
{{{
&requestformat=print
}}}
3. Next, open /PlantOMatic/config/ModelGlue.xml and find . Add a new attribute to the tag called format and assign the value of 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.
[[Image(training04-3.png, nolink)]][[BR]]
'' Print Friendly View ''
=== More Information ===
For more information about Model-Glue Request Formats, review the following documentation:
[http://docs.model-glue.com/wiki/HowTos/HowToUseFormats How To Use Formats]
----
Back: [wiki:Training/Section03 Training Section 3: Dealing with Data]
Next: [wiki:Training/Section03 Training Section 5: Mother's Little Helper]