Friday 7 September 2012

Create a Template - Visualforce


Templates are Visualforce pages containing special tags that designate placeholder text insertion positions. In this lesson you create a simple template page that uses the<apex:insert> component to specify the position of placeholder text.
  1. Create a new Visualforce page called BasicTemplate.
  2. Use the following as the body of the page:
    <apex:page>
        <apex:stylesheet value="http://developer.force.com/workbooks/vfdemo.css"/>
        <h1>My Fancy Site</h1>
        <apex:insert name="body"/>
    </apex:page>
The key here is the <apex:insert> component. You won’t visit this page (unless developing it) directly. Rather, create another Visualforce page that embeds this template, inserting different values for each of the <apex:insert> components. Note that each such component is named. In the above template, you have a single insert position named body. You can have dozens of such positions.

No comments:

Post a Comment