So you store your url in the database, does that mean you always will know
the url is stored in the following format?


domain / directory / page


If so, use a regex to remove the page and everything after it, i.e.
/.*\.cfm.* something like that I believe, but the regex gods will surely
help out here?
Then do your listlen and always subtract one form the result..

Taco Fleur
Blog  <http://www.tacofleur.com/index/blog/>
http://www.tacofleur.com/index/blog/
Methodology http://www.tacofleur.com/index/methodology/
0421 851 786
Tell me and I will forget
Show me and I will remember
Teach me and I will learn

-----Original Message-----
From: Ketan Patel [mailto:[EMAIL PROTECTED]
Sent: Friday, 23 January 2004 6:14 AM
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