Jason Congerton
Jason Congerton

Reputation: 830

Building URL Dynamically

I am trying to build a URL dynamically, i have a product feature table which holds the url. The purpose of this exercise is for a user to click on a link;

www.domain.com/climbing-frames_rockwall/ then the user can click on another link www.domain.com/climbing-frames_rockwall_step-ladder (rockwall and step-ladder are individual features). Each time a user clicks on a link i need to append the next feature.

So far i have

<cfset filterURL = "" />
<cfif IsDefined('url.feat') AND url.feat NEQ "">

<cfquery name="geturl" datasource="#application.dsn#">
SELECT txt_feat_url
FROM tbl_features
WHERE uid_features=<cfqueryparam cfsqltype="cf_sql_integer" value="#url.feat#">
</cfquery>
<cfset filterURL = filterURL & "_" & geturl.txt_feat_url>
</cfif>

Its not appending though?

Jason

Upvotes: 0

Views: 186

Answers (1)

Barry Jordan
Barry Jordan

Reputation: 2706

You are setting filterURL = "" at the top. So, in the following line you are just appending geturl.txt_feat_url to a blank string:

<cfset filterURL = filterURL & "_" & geturl.txt_feat_url>

That is why you are ending up with values such as "_monkey-bar" instead of "climbing-frames_rockwall-ladder_monkey-bar".Where are you expecting the value of filterURL to come from, is it the URL scope?

Upvotes: 1

Related Questions