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]
- Looking to figure out URL level deepness Ketan Patel
- RE: Looking to figure out URL level deepness Burns, John
- RE: Looking to figure out URL level deepness Ketan Patel
- RE: Looking to figure out URL level deepness Taco Fleur
- Re: Looking to figure out URL level deepness Nick Han
- RE: Looking to figure out URL level deepness Burns, John
- RE: Looking to figure out URL level deepness Dave Watts
- RE: Looking to figure out URL level deepness Pascal Peters