Well, if you're referencing URL variables in an included template,
then the URL variables are already available to the included template
without any effort, but if you're actually trying to parse a url, then
this should work.
<cfset your_url =
"joe/has/another/template.cfm?bodypart=brain&action=teaser&difficulty="/>
<cfset template=listfirst(your_url,"?")/>
<cfif listlen(your_url,"?") gt 1>
<cfset querystring=listlast(your_url,"?")/>
<cfloop list="#querystring#" delimiters="&" index="i">
<cfset left = listfirst(i,"=")/>
<cfset right = ""/>
<cfif listlen(i,"=") gt 1>
<cfset right= listlast(i,"=")/>
</cfif>
<cfset variables[left] = right/>
</cfloop>
</cfif>
<cfinclude template="#template#"/>
On 10/4/06, Joe Kelly <[EMAIL PROTECTED]> wrote:
For those who don't know, you cannot use url variables within a
cfinclude. The only way to pass url variables is to strip them off of
the template to be included and formally set them before the
cfinclude.
So this is similar to the first one I posed, but what would be the
most elegant way to do this?
Given: a template with url variables
Needed: 1. cfset (or cfscript) all the url variables
2. the template without the variables
Example
Given: joe/has/another/template.cfm?bodypart=brain&action=teaser&difficulty=3
Expect results:
<cfset bodypart="brain" />
<cfset action="teaser" />
<cfset difficulty=3 />
<cfinclude template="joe/has/another/template.cfm" />
For all you "Hey, Joe's getting free labor" naysayers, I've already
implemented my solution!
My money's on Marlon and Tom. Who wants to take them on?
Good Luck,
Joe Kelly
_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.HostMySite.com
www.teksystems.com/
--
Marlon
_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.HostMySite.com
www.teksystems.com/