PDA

View Full Version : Highlight Search Terms in Archive from Referring Search Engines


Cap'n Steve
01-12-2006, 10:00 PM
Using this modification, when someone finds your site through a search engine and clicks the URL that takes them to the Archive, the terms they searched for will be highlighted. This should work on all version of vBulletin less than or equal to 3.5.3. If you have 3.5.4 or later, install this hack instead.

Supported Search Engines (If you can think of more, please let me know.):
Google
Yahoo!
MSN
Altavista
Lycos
Ask Jeeves

Zia
01-13-2006, 06:50 AM
umm do u mind to xplain a bit? infact what it did? anything with SEO ?
Plz
Thnx

Zia
01-13-2006, 06:50 AM
umm do u mind to xplain a bit? infact what it did? anything that help SEO ?

Plz
Thnx

Cap'n Steve
01-13-2006, 06:58 AM
Here's an example: Imagine someone searches Google and your forum is in their search results. If they click the link it will take them to the Archive, and if you have this hack installed, it will highlight the words they searched for.

Snake
01-13-2006, 04:14 PM
Nice thanks!

Cap'n Steve
01-27-2006, 10:55 PM
Updated to fix a bug where words at the very end or beginning of the page might not get highlighted.

To upgrade, just replace clientscript/searchhighlight_replace.js with the new version.

djwins
02-26-2006, 05:12 AM
I've installed this but it doesn't seem to be doing anything.
Does this work with 3.5.4?

Perhaps the problem is related to this:
https://vborg.vbsupport.ru/showthread.php?t=108539

michaelbenson
02-26-2006, 11:03 AM
/me installs
I think djwins may have a point, perhaps some rewriting needs to be done.

djwins
03-01-2006, 03:34 AM
Anyone, bueller?

Cap'n Steve
03-01-2006, 03:40 AM
I didn't want to respond until I had an update ready, but thanks for pointing it out. Who knows how long it would have been until I noticed otherwise.

Anyway, here's the updated version.

djwins
03-01-2006, 04:13 AM
Hmmm...I downloaded the updated version, it didn't seem to work and now the link to the upgdate doesn't work. I'm guessing you found a problem with it or something...

Cap'n Steve
03-01-2006, 04:55 AM
No, it got deleted as a duplicate thread. I'll attach it in this post for now and hopefully they'll let me put it back in its own thread. What do you mean it didn't work?

djwins
03-01-2006, 05:02 AM
Its not highlighting anything when i click through to my archive from google (or yahoo).

Is it just the XML file that has changed for this version?

Cap'n Steve
03-01-2006, 05:59 AM
The xml file is the only thing that's required now. You can delete the other files.

Try finding this in the Search Text Highlighting plugin:
if ($vbulletin->options['enablehighlight'] AND preg_match('/([a-z0-9\-]+)\.([a-z]{3}\/|[a-z]{2}\.[a-z]{2}\/|[a-z]{2}\/)/i', $_ENV['HTTP_REFERER'], $domain)) {

and add above it
$output .= '<h1 style="color:red;">' . $_ENV['HTTP_REFERER'] . '</h1>';

It should print something in red when you follow an archive link. Tell me what it says or if it doesn't say anything.

djwins
03-01-2006, 06:05 AM
doesn't say anything.

Cap'n Steve
03-01-2006, 07:08 AM
What browser are you using? It depends on the browser sending the referring page and some have settings not to do that.

djwins
03-01-2006, 07:14 AM
I've tried it with both IE and Firefox and I haven't been able to get it to work with either.
Thanks for your help, btw!

Cap'n Steve
03-01-2006, 07:40 AM
Change the line you added to this:
$output .= '<h1 style="color:red;">Referrer:' . $_ENV['HTTP_REFERER'] . '</h1>';

It should at least say "Referrer" in red somewhere. If not, then the plugin's not even getting executed. Are you installing this on the site listed as your homepage? I'll try and take a look at it, but it'll have to wait until tomorrow.

djwins
03-01-2006, 07:43 AM
Yes, now I get Referrer: at the bottom of the page.
Yes, i am installing on the site in my profile.
Thanks!

Cap'n Steve
03-01-2006, 07:26 PM
Ok, click this link (http://forums.monkeycrap.com/archive/) and tell me what it says after "Referrer". If it doesn't say anything, it's a problem with your browser, but it looks like it has something to do with the way your host has PHP set up.

djwins
03-01-2006, 10:38 PM
It doesn't say anything after "Referrer" in either Firefox 1.5.0.1 or IE 6.0.2900

Cap'n Steve
03-02-2006, 12:10 AM
Ok, that's pretty weird. The one on my site works fine for me, but the one on your site doesn't. What kind of internet connection do you have and where do you host your site? Do you use a proxy or anything else unusual?

The code is right since it prints it for me, there must be something to do with your connection that's blocking the referer from being sent and also something with your version of PHP that's not setting the appropriate variable.

djwins
03-02-2006, 12:28 AM
Weird...my site is hosted in the USA but I am in Japan. I am not using a proxy.
I have cable/dsl (i think). Its built into my apartment building, so I am not exactly sure what I have.

My PHP (4.4.0) is in safe mode...could that be the issue?

Cap'n Steve
03-02-2006, 04:01 AM
The safe mode might explain why it doesn't work on your site, but it doesn't explain why you can't see it on my site. You might want to ask your host why the $_ENV['HTTP_REFERER'] variable doesn't get set properly.

djwins
03-02-2006, 05:44 AM
Actually, I can see it on your site...I take it back. I think I must have clicked through from my topic notification email.

Cap'n Steve
03-03-2006, 04:53 AM
Well that makes a little bit more sense. I've never heard of a server setup that blocks the referer from being used, but I'll investigate further.