Jason.

Thank you so much for the request_uri variable.  I'm putting in the code so 
anyone else having this problem won't have to go through the trouble.  The 
point of this code is to get rid of the query string on the end of the url 
so certain search engines don't choke on "?" and "&" etc.  I've done it 
before on NT servers and the extra hits from the search engines like 
altavista.com and excite.com are very much appreciated by my customers.

Note:

         1.  This is set up for a list behind the url and your column names 
need to be numeric (this is easy to remove if you don't.  Just look at the 
code and you'll figure it out).
         2.  If your on NT, I used cgi.path_info instead of request_uri
         3.  The code below works on a Cobalt box running linux anf cf 4.5 sp2

eg:  www.mysite.com/page.cfm/1,4

Code example:

<cfset urllist = 
"#replace(removeChars(request_uri,1,len(cgi.script_name)),"/","")#">

<cfif ListLen(urllist,",") gt 0 and IsNumeric(ListGetAt(urllist,1,","))>
         <cfset "ID" = ListGetAt(urllist,1,",")>

<cfquery name="product_retrieve" datasource="your_data_source">
         select *
         from your_table
         where ID='#ID#'
</cfquery>

<cfelse>

Sorry the product you have selected is no longer available (or what ever 
you would like).

</cfif>

<cfset urllist = 
"#replace(removeChars(request_uri,1,len(cgi.script_name)),"/","")#">

<cfif ListLen(urllist,",") gt 0 and IsNumeric(ListGetAt(urllist,2,","))>
         <cfset "ID_2" = ListGetAt(urllist,2,",")>

<cfquery name="product_retrieve_2" datasource="your_data_source">
         select *
         from your_table
         where ID='#ID#'
</cfquery>

<cfelse>

</cfif>

Brett

At 10:10 AM 2/24/01 +1000, you wrote:
>Yep, it certainly is possible
>
>Stripping script_name from request_uri should leave you with the same data
>that path_info should return
>
>If that doesn't work, there's bound to be some combination that does - I can't
>test it myself because I don't have CF.
>
>jason
>
>----- Original Message -----
>From: "Brett Frisch" <[EMAIL PROTECTED]>
>To: "CF-Linux" <[EMAIL PROTECTED]>
>Sent: Saturday, February 24, 2001 9:54 AM
>Subject: Re: path_info?
>
>
> > Jason,
> >
> > Your second example is exactly what I need.
> >
> > eg:  www.mysite.com/products.cfm/1  it would normally look like
> > www.mysite.com/products.cfm?ID=1
> >
> > I need the path_info so I pull the ID from a url like this:
> > www.mysite.com/products.cfm/1
> >
> > Currently, I can't get cf to return the path_info.  Lets say I put in
> > www.mysite.com/products.cfm/1 and have on my cf
> > template:  <cfoutput>#cgi.path_info#</cfoutput>.  When submitted, I get a
> > blank page.  I can get things like cgi.server_name and cgi.script_name but
> > no cgi.path_info.  It was a known bug before sp1 and should have been fixed
> > (the allaire forums say it was).  For some reason its not.  There's not
> > much I can do as its my ISP's server.  I guess what I'm looking for is some
> > sort of an alternate route for capturing the path_info.  Is it possible?
> >
> > Brett
> >
> >
> >
> > At 09:28 AM 2/24/01 +1000, you wrote:
> > >It probably just seems that way because either CF or IIS have generally
>always
> > >incorrectly returned path_info
> > >
> > >The path_info env var is supposed to contain anything after the requested
> > >script name, not the script name and preceding path itself
> > >
> > >eg:
> > >
> > >http://www.your.domain/script.cfm
> > >
> > >path_info should be empty
> > >
> > >http://www.your.domain/script.cfm/foo/bar
> > >
> > >path_info should contain /foo/bar
> > >
> > >What is your own understanding of what path_info should contain?
> > >
> > >
> > >----- Original Message -----
> > >From: "Brett Frisch" <[EMAIL PROTECTED]>
> > >To: "CF-Linux" <[EMAIL PROTECTED]>
> > >Sent: Saturday, February 24, 2001 8:33 AM
> > >Subject: path_info?
> > >
> > >
> > > >
> > > > >I'm wondering if there is a substitute to cgi.path_info?  My ISP 
> has cf
> > > > >linux sp2 on a cobalt box and cf won't report the path_info.  Perl can
> > > > >read it and output just fine but cf won't.  I've called my ISP but 
> they
> > > > >haven't been able to get it to work.  Is there something I can 
> point my
> > > > >isp too?  Is there some else I can do to get this info into my cf
> > > template?
> > > >
> > > > Thanks - Brett
> > > >
> > > >
> > > >
> > > >
> > > > Brett Frisch
> > > > Director of Design and Internet Technologies
> > > > Web Design Works Inc.
> > > >
> > > > -------------------------------------------------
> > > > http://www.webdesignworks.com
> > > > 1-970-266-9401 [Phone]
> > > > 1-970-266-8311 [Fax]
> > > > 1554 Quail Hollow Drive
> > > > Fort Collins, CO 80525
> > > > [EMAIL PROTECTED]
> > > > --------------------------------------------------
> > > >
> > > >
> > > >
> > >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-linux%40houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_linux or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to