I am stuck with one scenario here,

I have implemented one Visualforce page, which will be part of a Managed Package and will be represented on a Force.com website.

As this package can be used by multiple organizations. I would like this page would have the branding (css, logo, header, footer etc.) as per the organization.

The question arises here, how we can make these css, logo, header, footer dynamic, so that whichever organization uses this package can do their branding customization, even though this page is part of a managed package?

What do you all suggest here?

4 Answers 4


I agree with Adam about using static resources.

However, since you can't override static resource files that are part of managed packages your going to have to request that your individual installed organizations uploaded their own static resource files following a careful naming consideration.

Also dereferencing a non-existant static-resource url in a vf page like Adam suggested will cause the page not to compile:

<apex:image value="{!URLFOR($Resource.YourZipFileHere, 'header.png')}"/>

So your going to have to include placeholders, my only question is how your going to a compile a page to override this items in the installed org since you'll need those URLs but you also want them to change afterward. Someone might have a clever suggestion...but I don't think it's possible?

  • 1
    One possibility for dynamically referencing CSS would be to allow the user to configure a URL value (perhaps a custom setting) that pointed to an offsite CSS file of the user's choice. Then a mapping between class Ids and what they could override would need to be communicated.
    – Adam
    Aug 18, 2012 at 19:19

Great question (take 2:)

As jordan pointed out, the static resource of a managed package is not modifiable, which prevents modification after deployment.

Another possibility is to store your images as documents that can be referenced programmatically. Here's a reference to Sean Devine - referencing superfell's blog ;) This shows how to upload images from an external source, but should be instructive in terms of how to save an image as a document.

Unfortunately, if the static resource was modifiable - you could do this without any coding. But with some additional programming you could create an "image manager" Visualforce page that could allow the user to load images from their local to their org with your managed package installed. You can use the following to load the image from your Visualforce page:

<apex:inputFile value="{!file}" filename="{!name}"/>

In order to render your documents as images, you can include something like this in your controller:

public String imageURL
      String retVal;
      Document doc = [SELECT Id FROM Document WHERE Name = :nameString LIMIT 1];
      String imageId = doc.Id;
      imageId = imageId.substring(0, 15);
      retVal = '/servlet/servlet.FileDownload?file=' + imageId;
      return retVal;
   private set;

and then reference it within Visualforce like this:

<apex:image url="{!imageURL}" width="XXX" height="YYY"/>

(thanks, Ron Hess for the great example I modeled this after)

So, I hope that helps :)

  • 1
    Adam, I don't think you can override a static resource that is part of a managed package in an installed org. She would have to distribute all the contents in the static resource file for each org with the managed package. Aug 18, 2012 at 17:53
  • 1
    You're right Jordan - thanks. I was thinking about the dev org where my managed packed resides in, which is modifiable. But confirmed that in a deployed org the static resource is not modifiable. Editing answer now.
    – Adam
    Aug 18, 2012 at 17:59

Thank you all :) and Sorry for the late reply.

To resolve this issue,

We are using <apex:composition>, <apex:define> and <apex:insert> tags.

Create a VF page which will be part of manage package.

<apex:composition template="{!$Site.Template}">
    <apex:define name="DemoContent">
        Site content Goes here      

In subscriber org, we are going to create Site Template Page. This page will contain the branding of subscriber organization.

Template page:

    <!-- Add Logo with Header, Menus etc -->
    <apex:insert name="DemoContent" />
    <!-- As above line will containt page from managed package surrounded by subscribers branding-->
    <!-- Add Footer -->


Add this template page on Site Template Attribute.

The significan work is to create Template page for every subscriber. As this template is created in Subscribers org, the static resources will not create problem.

BY this way, we are handling the Branding.

What do you all suggest?

  • I think using Visualforce templates for your purposes is a good idea. You could also look into dynamic Visualforce components if you really wanted to go with a more data-driven solution, though this would also be a bit of work. salesforce.com/us/developer/docs/pages/Content/….
    – Adam
    Sep 16, 2012 at 17:37

Use of in managed package gives a problem (Provided template is not a part of manage package). If template page is part of managed package then it works.

I have also gone through some of the developer post. They also have faced the same issue.




We want to use different template page, not the page from package.

Is this a bug? Do you have any idea about this issue?

  • Were you able to handle this issue?
    – Prady
    Feb 26, 2016 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.