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
l.trincil.trinci 

Header & Footer

Hi, I was looking for a solution of this problem:

 

I need to include on my html/apex code a header and a footer that will be shown in every page created with different body(content)

 

I saved my footer and my header as static resources 

 

 

Thanks


Navatar_DbSupNavatar_DbSup

Hi,

 

You can create a component and you can use that component on your Vf pages:

 

Follow the below steps to create a component:

 Setup -> Develop -> Components-> Click New.

 

Use the below code snippet as reference:

 

 

<apex:component>

    <!-- Attribute Definitions -->

   

    <apex:attribute name="myValue" description="This is the value for the component." type="String" required="true"/>

    <apex:attribute name="borderColor" description="This is color for the border." type="String" required="true"/>

 

    <!-- Custom Component Definition -->

   

    <h1 style="border:{!borderColor}"/>

        <apex:outputText value="{!myValue}"/>

    </h1>

</apex:component>

 

 

To reference this component in every Visualforce page, you can use the following markup:

 

<c:myComponent myValue="My value" borderColor="red" />

 

 Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

 

l.trincil.trinci

I forgot to say that the static resources in reference to the header and footer are two images that I saved..

 

the code you wrote would be fine for images were saved in static resources too?

 

Thanks for the reply

Navatar_DbSupNavatar_DbSup

Hi,

 

You can use the static resource images in the component.

l.trincil.trinci

I just tested the code and it works, but I was looking for a solution that would show header and footer to each page without entering a code to each new page