apex:define

A template component that provides content for an <apex:insert> component defined in a Visualforce template page.

See also: <apex:composition>, <apex:insert>

Example

<!-- Page: composition -->
<!-- This page acts as the template. Create it first, then the page below.  -->	
<apex:page>
    <apex:outputText value="(template) This is before the header"/><br/>
    <apex:insert name="header"/><br/>
    <apex:outputText value="(template) This is between the header and body"/><br/>
    <apex:insert name="body"/>
</apex:page>
            
<!-- Page: page -->
<apex:page>
    <apex:composition template="composition">
        <apex:define name="header">(page) This is the header of mypage</apex:define>
        <apex:define name="body">(page) This is the body of mypage</apex:define>
    </apex:composition>
</apex:page>

The example above renders the following HTML:

(template) This is before the header<br/>
(page) This is the header of mypage<br/>
(template) This is between the header and body<br/>
(page) This is the body of mypage

Attributes

Attribute Name Attribute Type Description Required? API Version Access
name String The name of the insert component into which the content of this define component should be inserted. Yes 10.0 global

See Also