+ Start a Discussion
EmplEmpl 

How can I have single template rendering in different way for the different vf pages?

Hi,

 

I have a single template and I want to switch its few sections according to the vf pages which are calling this template.

All Similar type vf pages have different controllers and can extend from one base controller which is called from a template.

Is there any way to set a variable in from visualforce pages controllers so that my template knows from which pages its been called.

 

Thanks,

Vishal 

bob_buzzardbob_buzzard

Is this an Apex Composition template?   I have done something similar to this, though its a little convoluted.

  

In my template I have:

 

<apex:variable var="imgover" value="false"/>
<apex:insert name="imageoverride" />
<apex:outputPanel id="panel1" layout="none" rendered="{!imgover=='false'}">
..
</apex:outputPanel> 

<apex:outputPanel id="panel2" layout="none" rendered="{!imgover!='false'}">
..
</apex:outputPanel> 

 

This means that the default behaviour is that outputpanel 1 is rendered and outputpanel 2 isn't. However, I can then add the following to a page:

 

 

<apex:define name="imageoverride">
	<apex:variable var="imgover" value="true"/>
</apex:define>
    

which results in outputpanel 2 being rendered rather than outputpanel 1.