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
snejanasnejana 

Issue with doesn't exist file into zip static resource

Hi all.

 

I have logos.zip into static resource, which contains images with names: 'first.jpg' and 'second.jpg'.
'first' and 'second' are variables, which I retrieve from some field in custom object.

 

<apex:variable var="propertySlide" value="{!property.PropertyCode__c}.png" />
<apex:image url="{!URLFOR($Resource.logos, propertySlide)}" />

I need to be sure that if this field was empty or, for example, it equals 'third', I shouldn't see doesn't found image icon.

 

 

What should I need to do?

Best Answer chosen by Admin (Salesforce Developers) 
kiranmutturukiranmutturu
try like this

<apex:image url="{!URLFOR($Resource.logos, propertySlide)}" rendered="{!if((propertySlide == 'first' || propertySlide == 'second'),true,false)}" />

All Answers

Avidev9Avidev9
Just use the rendered property of the image tag

<apex:image url="{!URLFOR($Resource.logos, propertySlide)}" rendered="{!NOT(ISNULL(propertySlide))}" />
snejanasnejana

Thank you Avidev9, but it did not help.

kiranmutturukiranmutturu
try like this

<apex:image url="{!URLFOR($Resource.logos, propertySlide)}" rendered="{!if((propertySlide == 'first' || propertySlide == 'second'),true,false)}" />
This was selected as the best answer
snejanasnejana

Yea! It is works. Thank you very much.
This decision led me to another question:
Is there a way to programmatically determine the names of all the files in the archive?

kiranmutturukiranmutturu
yep you should dynamic visualforce components.....

have a look here

http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#CSHID=pages_compref.htm|StartTopic=Content%2Fpages_compref.htm|SkinName=webhelp
snejanasnejana

kiran_mutturu, I did not understand the last help message or maybe I badly explain my new issue.
I want to have some ability to fetch names all files from zip static resource.
Is it possible? If yes, what is a construction I should use. Maybe it's better to do in the class...