Crap! My email was down yesterday, and I didn't get to
play. Oh well, it was fun to read. :)
Chris
Joe Kelly wrote:
I guess that's all the submissions we'll have on that
one...
Here's what I used, quite similar to Marlon's answer.
<!--- this will strip out & set all url vars --->
<cfif Find("?",site.homePageURL)>
<!--- if any url vars, find the start --->
<cfset urlString = mid(site.homePageURL,
Find("?",site.homePageURL)+1,len(site.homePageURL)) />
<cfloop list="#urlString#" index="varAndVal"
delimiters="&">
<!--- grab the variable name and value --->
<cfset varName = ListFirst(varAndVal, "=") />
<cfset varValue = ListDeleteAt(varAndVal, 1, "=") />
<!--- set the url variable formally --->
<cfset "URL.#varName#" = varValue />
</cfloop>
<!--- strip url vars for include --->
<cfset site.homePageURL =
left(site.homePageURL,Find("?",site.homePageURL)-1) />
</cfif>
<cfinclude template="#site.homePageURL#">
Thanks for playing,
Joe Kelly
On 10/4/06, Joe Kelly <[EMAIL PROTECTED]> wrote:
I see where the confusion is now. I guess
Marlon is the mind reader.
He's right on. I didn't clarify that the cfincluded template
contained the url variables and not the calling page. Sorry about
that Chief.
Thanks,
Joe Kelly
On 10/4/06, Dave Shuck <[EMAIL PROTECTED]> wrote:
> I was thinking the same thing Nate, but I didn't have time to
test. I was
> almost ceratain that one of our older production applications did
this.
>
>
> On 10/4/06, Nate Nielsen <[EMAIL PROTECTED]> wrote:
> > I guess I don't get the question because you can use url vars
in an
> included
> > template just fine. Not that you would want to.
> >
> > test.cfm :
> >
> -------------------------------------------------------------
> > url param is : <cfinclude template=" testinclude.cfm">
> >
> -------------------------------------------------------------
> >
> > testinclude.cfm :
> >
> -------------------------------------------------------------
> > <cfparam name="url.param" default="none!">
> > <cfoutput>#url.param#</cfoutput>
> >
> -------------------------------------------------------------
> >
> > now execute : test.cfm and test.cfm?param=hello
> >
> > The form and url scopes are available similar to the request
scope.
> You'll
> > see it works just fine. Again, I wouldn't suggest it, its
ugly and
> > difficult to manage / trace. =)
> >
> > What would the business case for doing something like this
be?
> >
> > -Nate
> >
> > ----- Original Message -----
> > From: "Joe Kelly" <[EMAIL PROTECTED]>
> > To: "Dallas/Fort Worth ColdFusion User Group Mailing List"
> > < [email protected]>
> > Sent: Wednesday, October 04, 2006 9:02 AM
> > Subject: [DFW CFUG] Yet another Brain Teaser!
> >
> >
> > > 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=""
> > > Expect results:
> > > <cfset bodypart="brain" />
> > > <cfset action="" />
> > > <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/
> >
> >
> > _______________________________________________
> > 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/
> >
>
>
>
> --
> ~Dave Shuck
> [EMAIL PROTECTED]
> http://www.daveshuck.com
> _______________________________________________
> 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/
>
>
>
_______________________________________________
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/
|
_______________________________________________
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/