NameSilo

Parsing urls in a script

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

liam_d

The original NP Emo KidEstablished Member
Impact
25
Hi all i have this;

PHP:
	//urls	
	$chr_limit = '45';
	$add = '...';
	
	$view = preg_replace("!(http:/{2}[\w\.]{2,}[/\w\-\.\?\&\=\#]*)!e", "'<a href=\"\\1\" title=\"\\1\" target=\"_blank\">'.(strlen('\\1')>=$chr_limit ? substr('\\1',0,$chr_limit).'$add':'\\1').'</a>'", $view);

Although that doesn't parse urls if there is no http://, can anyone modify that or create one like it to handle urls with the http:// ?

Thanks!
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
0
Close
Thats not what i mean, parsing url for bbcode it what im doing...if you know php you would read my code above and understand :P
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back