Trimming filename and paramters from a URL (output from DB)

S

Simon

Hi there.

I seem to be a flurry of questions here recently, thanks for you help all,
but ... got another question here.

I am storing URL in a database for a 'sort of' directory type website.

The <a href> is built from the recordset of URL's which is all working no
problem, easy stuff.

What I have found is going to be necessary in some cases is to trim the URL
back to just it's www.abc.co.uk address for the link display.

I still want the actual link to go to it's long 'deep linking' location, but
there is limited room for displaying a URL that could be a hundred chars
long.

So... Just to recap.

www.abc.co.uk/products.asp?cat=1&id=234&somethingelse=12

gets trimmed back to

www.abc.co.uk

Thanks in advance.

Simon.
 
S

Simon

I got ;-)

I realised I was trimming the http:// from the inputted URL, so I only had
to search for the first / and stop there.

<%

if not rs("URL")="" then

iURL = instr(rs("URL"), "/")
if iURL then tURL = left(rs("URL"), iURL-1) else tURL = rs("URL")
fURL = tURL


%><strong>Website</strong> : <a href="http://<%= rs("URL") %>"
title="<%= fURL %>"><%= fURL %></a><br /><% end if %>

Take care

Si
 
E

Evertjan.

Simon wrote on 28 okt 2004 in microsoft.public.inetserver.asp.general:
trimming the http:// from the inputted URL


fURL = replace(rs("URL"),"http://","/")

or

fURL = replace(rs("URL"),"http:/","")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top