You need to sign in to do that
Don't have an account?
Ruchie
How to read the contents of css/HTML file placed in documents or Static Resources.
Hi,
Can anyone please help, how to read the contents of the CSS file or any other file placed in the documents. I need this, so that i can read the contents of CSS and modify the code accordingly, instead modifying in the CSS. Also, this is required, if i place the HTML static code in documents and name the file as header, footer. SO, i need to read the HTML content fom that file, and create the static HTML on the VF Page. I want to use that file as template in the VF page. Please help.
Thanks
For .css files:
<HEAD>
. . . .
<LINK href="{!$Resource.myresourcename}" rel="stylesheet" type="text/css">
. . . .
</HEAD>
For .html files:
<apex:include pageName="mypagename"/>
Hey
Salesforce has ways to create templates using <apex:composition>, <apex:define> and <apex:insert>. Using documents for templating and CSS is going to be unnecessarily difficult. And example of the above use is
Create a page called MyTemplate.page and code it thus
<apex:page id="TheTemplate">
<apex:insert name="header"/>
<apex:insert name="body"/>
</apex:page>
And in the page using the template
<apex:page>
<apex:composition template="TheTemplate">
<apex:define name="header">
<h2>Hello</h2>
</apex:define>
<apex:define name="body">
<!-- The rest of you page here -->
</apex:define>
</apex:composition>
</apex:page>
You can use static resources for CSS and include them in the page, although I recommend using components. An example of this can be found here.
Wes