Ketan,

I don't think there's any easy / sure-fire way to do it then.  You've
got so many variables to take into consideration.  Do any have http://
in them, do any have a / in the url variables?  You might be able to do
some complex stuff with finding the first / after .com (maybe make an
array of extensions to search the string for) and if you find one grab
everything to the right of the next / , then find the last / (maybe
reverse the string) and strip off everything after the last slash.  If
you're left with 1 /, then you have no folders.  If you're left with 2,
you have one folder.  Then you just have to have some logic to make sure
the last / you found wasn't a parameter in the url variables.

John

-----Original Message-----
From: Ketan Patel [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 22, 2004 3:14 PM
To: CF-Talk
Subject: RE: Looking to figure out URL level deepness

Hi John,
I cannot use cgi.script_name because in my case I have to pull the info
from the database where I have stored URL's.
Ketan Patel

  -----Original Message-----
  From: Burns, John [mailto:[EMAIL PROTECTED]
  Sent: Thursday, January 22, 2004 2:52 PM
  To: CF-Talk
  Subject: RE: Looking to figure out URL level deepness

  Well, instead of doing the whole url, you know you don't care about
the
  domain name, so just do it on cgi.script_name and that will just give
  you the folders and the file name and url parameters.  If someone goes
  to a site like www.blah.com/foo/index.cfm the script_name variable
will
  contain /foo/index.cfm and if they just go to www.blah.com/foo/ the
  script_name variable will still contain the full path /foo/index.cfm
(it
  won't leave the index.cfm off just because the person didn't type it)
  Then just evaluate how many slashes there are and subtract 1.  That
  should give you the number you're looking for.

  /index.cfm - 1 slash - 0 folders
  /foo/index.cfm - 2 slashes - 1 folder
  /blah/something/foo/index.cfm - 4 slashes - 3 folders

  John Burns

  -----Original Message-----
  From: Ketan Patel [mailto:[EMAIL PROTECTED]
  Sent: Thursday, January 22, 2004 2:43 PM
  To: CF-Talk
  Subject: Looking to figure out URL level deepness

  Hi All,
  I am trying figure out deepness of the URL

  eg:
  <cfset theurl="www.wyndham.com/hotels/BWIIH/main.wnt">
  <cfset deepnessCount = ListLen(trim(theurl), "/")>

  returns me 4 actually it should return me 3 due to ffolder levels

  <cfset theurl="news.com.com/2100-7344-5139640.html?tag=nl">
  <cfset deepnessCount = ListLen(trim(theurl), "/")>

  returns me 2 and I am looking for answer 0 becuase its a root level. I
  am trying to fihure how many levels deep is the URL.

  Ketan Patel
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to