function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Devendra@SFDCDevendra@SFDC 

Managed package VF page referencing $Site.Template Giving Problem

Hello Board,

 

I am having a problem with the <apex:composition> tag. I have created my Sites application in my development org and packaged the VF pages and Controller into a managed package.

When I install the package into the destination org, the only Site Template I'm able to use is the site template that I packaged with my app. I want to allow the user to create their own Site Template (unmanaged, in their org) and set this page as the Site Template.

 

<apex:page>
<apex:composition template="{!$Site.Template}">
<apex:define name="myContent">
Hello Salesforce!!!
</apex:define>
</apex:composition>
</apex:page>

 

And the template I package with my app:

<apex:page >
<div class="content">
<apex:insert name="myContent" />
</div>
</apex:page>

 


When I deploy my package, if i configure my Site to use the template that I've packaged, everything works fine. But the moment I change the Site Template to point at a different template that didn't come with my package.

 

I want to allow user to select template which is not a part of managed package.

 

Thanks,
Devendra

bob_buzzardbob_buzzard

What happens when you change the template to one local to the org (i.e. not your managed package)?

Devendra@SFDCDevendra@SFDC

 

Bob,

 

Thanks for the response.

 

It displays nothing when we apex method is called onclick of <apex:commandButton>.

 

We wanted to create Branding for site page.

 

We are dynamicaly adding custom fields of Campaign Member object on VF page. These fields are populate on page dynamically. We are storing which fields to display on form in one custom object.

 

And dynamically populating those values on form.

 

Something like this.

<apex:repeat value="{!lstFields}" var="lst">
<apex:inputField value="{!lst.Name}"
</apex:repeat>

 

It works well in Dev Org.

 

It also works well in managed package when managed package page is set as a template.

 

But, when we use unmanaged page as site template, the page displays nothing onclick of <apex:commandButton>.

 

Thanks,
Devendra