Forum Moderators: phranque
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.
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. ;-)
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
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.