Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if html file exists show image

Status
Not open for further replies.

juliepoolie

Technical User
Aug 9, 2001
1
IE
Wondering if it is possible to do the following and if so how would I go about it? I’m afraid I have limited experience with these types of technical problems.

I wish to include a special offers page on my site. This page will be accessed from every other page on the site through a special offers button.

There will not always be special offers. For this reason, I need a method of detecting whether or not the specialoffers.html page is present on the server. This in turn will either display or hide the button depending on the status of the specialoffers.html file.

Is there some sort of CGI script that I can apply to the button to do this or perhaps I can incorporate SSI?
 
Well, you could use a little Perl script like so:

[tt]

if (-e "path/to/your/file/specialoffers.html") {
print &quot;<a href=\&quot;whatever.html\&quot;><img src=\&quot;image.jpg\&quot;></a>\n&quot;;
}
[/tt]

The -e check to see if a file exists on the server. If it does, then print out the special offers image.

Hope this helps.
-Vic vic cherubini
krs-one@cnunited.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top