473,842 Members | 1,600 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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.

http://www.abc.co.uk/products.asp?ca...methingelse=12

gets trimmed back to

www.abc.co.uk

Thanks in advance.

Simon.
Jul 21 '05 #1
2 1380
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>Websi te</strong> : <a href="http://<%= rs("URL") %>"
title="<%= fURL %>"><%= fURL %></a><br /><% end if %>

Take care

Si
"Simon" <si************ *@blueyonder.co .uk> wrote in message
news:xo******** *************@f e2.news.blueyon der.co.uk...
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.

http://www.abc.co.uk/products.asp?ca...methingelse=12

gets trimmed back to

www.abc.co.uk

Thanks in advance.

Simon.

Jul 21 '05 #2
Simon wrote on 28 okt 2004 in microsoft.publi c.inetserver.as p.general:
trimming the http:// from the inputted URL

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

or

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

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4835
by: Generic Usenet Account | last post by:
I have worked out the following implementation for trimming the leading and trailing whitespace characters of a string (I am surprised not to see these as member functions). Am I doing it correctly, or is there a better way to do it? Thanks, Gus //////////// Source code begin /////////////////////
7
2309
by: ColinWard | last post by:
Hello. I use the following line which returns the path of a file and adds it to a listbox. How can I modify this line so that it only returns the filename and not the entire path? --> TxtAttachment.AddItem (vrtSelectedItem) vrtSelectedItem is the variable which contains the path. Thank you
5
3517
by: Brian Henry | last post by:
I have a messaging application that has a data grid with information like an email list would have (from, subject, time sent, size) but the subject could be very long in theory, and then it would word wrap.. the subject is a variable width column (resizes to fit space) while the others are fixed size... the problem is that i dont want the text to ever word wrap.. but truncate the visible subject to match the current cell width... (kinda...
10
13096
by: Brian Gruber | last post by:
Hi, I'm looking for a way to rename a whole directory of files in short order. The files in the directory have different lengths, however all of them end with _xxxx the x's represent a randomly generated number from a program that I saved from. So I need to find a way that I can quickly remove the underscore and the last 4 numbers from the filename without changing anything else. I can't set a max length to the file becuase the filename's...
0
1213
by: Paul | last post by:
On my local site, I have a folder that is security trimmed, so that only members of a Role can see it after they register and log on (I set the memberships). All works fine locally. However, when I deployed to my ISP, the security trimming does not work. Here is the relevant code. I can add users just fine, they show up in the ISP SQL Server database, and I can log on and off.
4
2512
by: B Squared | last post by:
I'm trying to pass a filename (which is a jpeg image) to a php function / file so that it will display. I know that its simple to get PHP to display an image hardcoding in the filename. For example, an href to this: <?php header("content-type:image/jpeg"); $filename = "image_file.jpg"; $im=ImageCreateFromJPEG($filename); ImageJPEG($im);
8
2826
by: PvtPile | last post by:
I've got a form where i need to pull both the directory of a filename and the directory with the filename of an .inf file... I figured the easiest way to do this was to have an <input id=test type=file runat=server> control for the user to find the .inf file, and then make vb cut off the filename upon submission of the form. I just can't figure out how to trim off the filename leaving just the directory it's located in. just as a test...
3
1959
by: Enyi | last post by:
Situation : Need to get a list of files in a directory, but I am currently getting the whole path of the file (Example: "C:\A Folder\Another Folder\file.txt"). What I want is just the filename and extension. So from above example, all I actually want is "file.txt". Language: VB.NET 2005 Current Code: Imports System.Collections.ObjectModel ... Dim files As ReadOnlyCollection(Of String)
12
4271
by: vj | last post by:
I am using Borland C++. I run a program which generates output data files, say 'Voltage.dat', 'Current.dat'. I have a variable in my code (say N), and for various values of N (for each value of N), I generate these output data files. After running the program once for a given value of N (say N equal to 1) and when the programme is finished, I manually append the generated filename with the value of N, such as 'Voltage_N1.dat',...
0
10610
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7855
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7035
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5696
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5884
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4499
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4089
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3144
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.