Forum Moderators: open
If perl, just map your words into an associative array for easy removal of the dupes.
@page = split(/ /,$page); #where $page = the page text.
foreach (@page) {
%words{$_}++;
}
#now the page words are in %words.
foreach $key (sort keys %words) {
$key ...do something with the word here for your link...
}
There are a bazillion ways to do it depending on your structure. I'd certainly get rid of the dupes.
Would a search engine see a difference between...
/search.html?foo1 or /search.html#foo1
/search.html?foo2 or /search.html#foo2
...even if they are both the same page? If they would see a difference then my solution would be vastly simplified.
Here is the current code:
$message =~ s/ any words/ <a href="$link">any words<\/a>/g;
$message = entire variable from text input form
$link = link to keyword page
" any words" = parsed language in form($message)
Now lets say that there are three occurances of " any words" in $message. How would I change just the first occurance into a link and leave the rest alone?
Now that the messages will be linked to relevent pages (automatically) on the site (without repetitive links) how do you (or others) think the search engine spiders will react?