Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Shrinking links in forum posts
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Shrinking links in forum posts

 Post Reply Post Reply
Author
Mattblack View Drop Down
Groupie
Groupie
Avatar

Joined: 21 January 2003
Location: United Kingdom
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mattblack Quote  Post ReplyReply Direct Link To This Post Topic: Shrinking links in forum posts
    Posted: 04 July 2006 at 8:13pm
Hi,
 
I have a forum system that I have made.  Users are able to submit data to a database, which is then pulled from the database in a posts page.
 
Each post in the table is in its own table/cell within the posts page.
 
If a user submits a link that is excessively long, it stretches the table (as do pictures).
 
Is there any way I can only show the first x characters of the link, whilst keeping the URL of the link intact???

In the database, the data will look as follows...
<A title=LINK href="link_url_here">LINK</A>
 
How can I only show x characters from the LINK part before the </A> ???
 
Im tearing my hair out with it.  Its the same for pictures posted that are too big for the table column/cell width.
 
What am I best to do?
 
Really appreciate any help on this.
 
Matt
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 04 July 2006 at 11:25pm
Unless I'm missing something obvious, I'd use Instr to search first for a <A (lcase), and then for the next >. After that I'd use Instr to find the position of the first </A and then check the length between the first > after <A and the </A. If greater than some value, use Mid to replace the string with something like "LINK:timestamp". or you can use Rtrim and Mid to shring the original string.

There's an example of how to pull data from between 2 character strings here - http://new2asp.com/Section_Files/PullStrings/PullStrings.asp

You'd be better off to do it when the info is added to the db. That way you only do it once, not everytime the page is displayed.

IIRC, ASPJpeg ca resize images it uploads and can also determine the size of the image if you just want to handle it by adding height and width attributes to the image tag. It'll beat your server to death though. There's really no elegant way to do this. Fluid instead of fixed layout is the only really viable solurion other than telling your users not to do it.


Edited by dpyers - 04 July 2006 at 11:27pm

Lead me not into temptation... I know the short cut, follow me.
Back to Top
Mattblack View Drop Down
Groupie
Groupie
Avatar

Joined: 21 January 2003
Location: United Kingdom
Status: Offline
Points: 139
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mattblack Quote  Post ReplyReply Direct Link To This Post Posted: 09 July 2006 at 12:24am
thanks mate, ill work on trying this.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.