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

cfswitch - application.cfm - problem 1

Status
Not open for further replies.

coldfused

Technical User
Jan 27, 2001
2,442
US
Can someone try this for me please?


Application.cfm:
Code:
<cfset GlobalSwitch="Home,Resort,Location,Contact">

Page.cfm
Code:
<cfswitch expression="#PageTitle#">
<cfcase value="GlobalSwitch">
<cfoutput>
<title>#metaTitle["#PageTitle#"]#</title>
<meta name="Description" content="#metaDescription["#PageTitle#"]#" />
<meta name="Keywords" content="#metaKeywords["#PageTitle#"]#" />
</cfoutput>
</cfcase>
</cfswitch>

I can't get the cfcase "value" to populate with the variable "GlobalSwitch".

Any ideas why this won't work?

----------------------------------------
Always Learning...
 
Doesn't work. I tried that before I posted and I get this error message:

Code:
This expression must have a constant value.  
 
  
ColdFusion cannot determine the line of the template that caused this error. This is often caused by an error in the exception handling subsystem.

That's whay I wanted you to guys to try it so you can see what it was doing. Are we not able to populate a cfcase value from a variable?

CArl

----------------------------------------
Always Learning...
 
hey, i never knew that (probably because i don't use CFSWITCH)

if you only have one CFCASE inside your CFSWITCH, why not use a simple CFIF?

r937.com | rudy.ca
 
#PageTitle# is defined at the begining of each page.

----------------------------------------
Always Learning...
 
i knew that :)

try this --

<cfif ListFindNoCase(GlobalSwitch,PageTitle)>
<cfoutput>
<title>#metaTitle["#PageTitle#"]#</title>
<meta name="Description"
content="#metaDescription["#PageTitle#"]#" />
<meta name="Keywords"
content="#metaKeywords["#PageTitle#"]#" />
</cfoutput>
</cfif>

i dunno about the meta stuff, but the ListFindNoCase should work

r937.com | rudy.ca
 
Awesome Rudy, thanks so much for that. Any idea why Coldfusion will not let us populate the cfcase value?

Carl

----------------------------------------
Always Learning...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top