Reusing Pages with Templates

Reusing Pages with Templates - 

Create a Template - Create a new Visualforce page called  BasicTemplate.

<apex:page>
<h1>My Fancy Site</h1>
<apex:insert name="body"/>
</apex:page>

Use a Template with Another Page - Create a new Visualforce page called  MainPage

<apex:page sidebar="false" showHeader="false">
   <apex:composition template="BasicTemplate">
      <apex:define name="body">
      <p>This is a simple page demonstrating that this text is substituted, and that a banner is created.</p>
      </apex:define>
   </apex:composition>
</apex:page>

Include One Visualforce Page within Another - Create a new Visualforce page called  EmbedsAnother

<apex:page sidebar="false" showHeader="false">
  <p>Test Before</p>
  <apex:include pageName="MainPage"/>
  <p>Test After</p>
</apex:page>

Comments

Popular Posts