salesforce - Zipped css in static resource are not rendered, why?
I zipped the CSS and image file so that the images are accessible by the CSS.
http://www.salesforce.com/us/developer/docs/pages/Content/pages_resources.htm
I've followed documentation code but it is not rendered at all.
<apex:stylesheet value="{!URLFOR($Resource.jquery_dialog_css_img,
'jquery_ui_one_dot_eight_dot_eleven.css')}" />
zipped file structure is:
[jquery_dialog_css_img] ---- jquery_ui_one_dot_eight_dot_eleven.css
|
|---images ----- someImage.jpg
When the visualforce page is rendered the import tag looks like:
<link class="user" href="/resource/1301916406000/
mane开发者_如何学Gonabi__jquery_dialog_css_img/
jquery_ui_one_dot_eight_dot_eleven.css"
rel="stylesheet"
type="text/css" />
It looks correct and I have no idea why it is not working. When I click on the generated link:
/resource/1301916406000/ manenabi__jquery_dialog_css_img/ jquery_ui_one_dot_eight_dot_eleven.css
The page is all blank which (I think) means somehow the path is not correct. (If is is correct, the popped up page would show the code like js or css)
Ok... I had to include root directory.. come on doc, u didn't say that :(
I wanna shoot Salesforce with my paintball.
<apex:stylesheet value="{!URLFOR($Resource.jquery_dialog_css_img,
'jquery_dialog_css_img/jquery_ui_one_dot_eight_dot_eleven.css')}" />
Actually the key here is to make sure your zip file name is the same as the resource name.
So this code:
<apex:stylesheet value="{!URLFOR($Resource.name, 'style.css')}" />
Has to correspond to a resource called 'name' and the file uploaded to the resource also has to be exactly 'name.zip'.
Then inside name.zip, you should put the style.css file and the images directory
精彩评论