Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

HELP!! with automatic URL

Status
Not open for further replies.
Joined
Jan 5, 2008
Posts
49
Reaction score
1
Hi, I really hope someone can help me with this.

Basically when a user comes onto my site and posts a job, If they supply a URL, is there any way that I can make the URL be autmatically linked, as email clients do?

So they just type in www.website.com and hey presto it becomes an active link.

PLEASE, anyone put me out of my misery .... (with an easy answer!)
 
look at my last post, it did it too!

You see there you go my last post went and did it too.
 
It depends on what you are using. Is it code you have done yourself? Wordpress? A forum?

Everything will have ways of doing it differently.
 
Hi, thanks for replying.

No its just normal html/php and mySql.

I see the gumtree.com has it too, if you post a job or advert they make the link active.

any thoughts...
 
Well if it's your own PHP then you just need to pass it rhough a function before writing it to the database OR before displaying. That function would need to take the job advert text and look for "http://" or "www." and then process until the next space character.

It can get complicated as they might have urls with http:// or www. and might have more than one, so you need a recursive function that will find all occurances. You just need to then split at the http / www and at the next space and reinsert it with a href tags around it. Maybe split the whole string into an array at each space character. Then loop through the array. For any element that matches your URL string (http or www) replace that array value with the same string with the href tags. Then recombine the whole array (remembering to put the spaces back in!)

I would guess that there are various PHP functions to do this floating around the web as it's a common requirement. If not try and poke around the source for something that does do it and see how they did it.
 
Thanks for your Advice. What keywords would I search for that?

Sorted the problem short term, I was re-skinning an old turnkey script, and found the guy had it all done in php/mysql, but didnt follow it through in the html.


Still would like it to do what I originally stated, but can live with this for now.

Thanks
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom