I did something like this relatively recently, with the added requirement that 
both the variable name and the value be encrypted (fun, eh).  On top of that, 
there was a handler page that I had to ensure was continuing to attach all of 
my url vars to the url for cflocation.  I'll give you my code snippets here and 
hopefully you can mine something useful out of them:

Handler page looping through variables to attach url scope to cflocation url:

<cfset myhomepage = "this is my link">
<cfset urlscope = "" />

<cfloop collection="#url#" item="key">
        <cfif decrypt(key,application.EncryptSeed,"CFMX_COMPAT", 'Hex') EQ 
"linkfrom"><!--- var lets me know it's coming from an email; reroute --->
                <cfset myhomepage = "different page here">
        </cfif>
</cfloop>

<!--- append any url variables --->
<cfloop collection="#url#" item="key">
        <cfset urlscope = urlscope & "&#key#=#url[key]#" />
</cfloop>

<cfif len(urlscope)>
        <!--- then swap out the first & for a ? and append to our link --->
        <cfset urlscope = REReplace(urlscope, "&", "?") />
        <cfset myhomepage = myhomepage & urlscope />
</cfif>

<cflocation addtoken="no" url="#myhomepage#">


Then on a given page where I needed to know if an ID had been passed in....

        <cfloop collection="#url#" item="key">
                <cfif decrypt(key,application.EncryptSeed,"CFMX_COMPAT", 'Hex') 
EQ "project_id">
                        <cfset request.project_id = 
decrypt(url[key],application.EncryptSeed,"CFMX_COMPAT", 'Hex') />
                </cfif>
        </cfloop>



> If I'm passing an URL Variable - with the variable name itself being 
> dynamic, what's the best was to extract the variable name (not the 
> value) on the receiving page?
> 
> As in:
> for: index.cfm?somevar=somevalue
> I need to return "somevar" on the receiving page as a value.
> 
> or for: index.cfm?bigdog=bruto
> I need to return "bigdog" on the receiving page as a value.
> 
> The receiving page won't know what the variable is in advance...
> 
> Did that make any sense at all?
> 
> 
> __________ Information from ESET NOD32 Antivirus, version of virus 
> signature database 5263 (20100708) __________
> 
> The message was checked by ESET NOD32 Antivirus.
> 
> http://www.eset.com
> 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335298
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to