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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI variables

Status
Not open for further replies.

clustcant

Technical User
Feb 3, 2003
2
US
Having some trouble with this and I hope you guys can help. When I build my appliocation.cfm, I'm trying to set a CGI variable for pathing out my images. But nothing works. Every path config I try does not work. And the current project I'm on has a lot of includes but images are not showing in my includes.
Any help?
 
ColdFusion is not able to set CGI variables, AFAIK. They're exposed as read-only.

But the good news is you really don't need to. If you're using an Application.cfm, you can simply set a standard Variable scope variable and all the .cfm files that use that Application.cfm will have access to it.

ie-
Application.cfm-
Code:
<CFSET Variables.myImagePath = &quot;/images&quot;>

and
somePageInTheSameDirectory.cfm-
Code:
<CFOUTPUT><IMG SRC=&quot;#myImagePath#/someimage.gif&quot; /></CFOUTPUT>

Or, I'm not quite sure why you would in this case, but you could set an application, session, or client variable, too, that could be used universally (well, within the appropriate scope).


BUT, I'm not entirely sure this would be the appropriate solution to your problem, anyway. You should always be spec'ing images with their paths relative to the webroot. Why are they not showing up?
Hope it helps,
-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top