Welcome to WebmasterWorld Guest from 54.159.165.175

Forum Moderators: phranque

Automatic Text to Hyperlink

   
8:52 am on Mar 8, 2009 (gmt 0)

5+ Year Member



Hi All,

Can anybody please recommend any scripts that can be setup to automatically replace text with a URL's.

A lot of sites seem to have this feature, I cant find any scripts that will enable me to do this.

Thank you

1:14 pm on Mar 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you have any coding background? It is fairly straight forward if you have the ability to write some code yourself.

Are you talking about replacing a text url with a real link? Or are you talking about replacing actual keywords with links?

I've recently implemented both on my site(s), but it was all custom coding done in Perl.

8:16 pm on Mar 8, 2009 (gmt 0)

5+ Year Member



I do have a programming background, but not too recent and not with Perl or Java.

Im talking about replacing keywords with Links/hyperlinks.

I was hoping that there is a pre-build script I can include and maybe update a text file with keywords and url's.

9:02 pm on Mar 8, 2009 (gmt 0)

WebmasterWorld Senior Member kaled is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Three questions...

1) Why? I've seen this feature many times and it is just plain annoying.
2) What technology are you using? (static html, php, etc.)
OR
3) Are you thinking of using javascript on the client-side? If yes, visiting the javascript forum would be advisable.

Kaled.

9:22 pm on Mar 8, 2009 (gmt 0)

5+ Year Member



How else would I do internal linking of pages, If I do it manually it will take a very very long time.

From what I been reading internal linking is very important to Search Engines, what are the alternatives?

My pages are all php

4:02 am on Mar 9, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think if it is done tastefully it can be extremely useful. Wikipedia is built off this concept.

We ended up building our own custom script for this that was heavily taylored to our content. My guess is you will need something very custom as well if you want it to work properly and not just link to unrelated stuff.

A other benefit is to thwart scapers. Embedding absolute links in your content makes those links portable when someone copy and pastes your page. Easy enough for bots to filter, but it is an extra step for them.

Lastly, it can help search bots find more of your content and make your page more relevant by having these related pages linked to your content.

You can't argue with the success wikipedia has in search results. ;-)

11:22 am on Mar 9, 2009 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



My pages are all php

Is the content in a database? if it is, it's fairly easy.

$pairs = array(
'/keyword/' => '<a href="http://www.example.com/">keyword</a>',
'/otherword/' => '<a href="http://www.example.com/">otherword</a>',
);
while ($newArray = mysql_fetch_array($result)){
$text = preg_replace(array_keys($pairs), array_values($pairs), $newArray['text'], 1);
}

The 1 at the end is so it only changes the first mention of that word.

HTH

8:04 am on Mar 10, 2009 (gmt 0)

5+ Year Member



Hi, Unfortunately its not in a database, that is why I wanted to call some script that would look for my keywords and replace them with links.
9:18 pm on Mar 14, 2009 (gmt 0)

5+ Year Member



Anybody please - I really don't want to cross link all of my pages manually.
4:34 am on Mar 15, 2009 (gmt 0)
10:45 am on Mar 16, 2009 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



This topic has been discussed a lot recently around the net in wordpress circles. The plugin aLinks used to do this for most blogs but the author closed the site a year ago and the plugin stopped working.

Of all the options a plugin called cross-linker is confirmed to work on the latest version of wordpress (2.7.1) and it does it's thing well.

You said you're running a php site but not using a database so I assume you're not running wordpress. That being said the plugin is open source and the core functions can be extracted from the code.

I'm mentioning the plugin because this subject affects wordpress users too.

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month