Google search terms highlighted within result pages

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Google search terms highlighted within result pages

Post by Luke »

I just typed "test driven development in php" into google, and when I clicked on the second result, it took me to this page:
http://blog.casey-sweat.us/?p=49

Now on this page, "test", "driven", "development", "in" and "php" were highlighted. How in the world is this accomplished?

Source code on the page looks like this... so this is accomplished server side??

Code: Select all

<p>Here is the <span class="hilite">Test</span> <span class="hilite">Driven</span> <span class="hilite">Development</span> <span class="hilite">in</span> PHP presentation from <span class="hilite">php</span>|tropics.  You can download either the <a href="img/phpt_tdd.zip">zip</a> or <a href="img/phpt_tdd.tgz">tarball</a> flavors.  <span class="hilite">In</span> each is the PowerPoint presentation and the code files with unit tests I used when writing the presentation.</p>
EDIT: I just realized this is sweatje's blog... so maybe he can answer this for me.
User avatar
pedrotuga
Forum Contributor
Posts: 249
Joined: Tue Dec 13, 2005 11:08 pm

Post by pedrotuga »

very simple.

1.check if the user comes from google/yahoo/live.com/whatever
2. if so get the search words from the referer
3. replace every ocorrence of keyword string by "<span class="hilite">Keyword</span>"

there ya go
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

hmm... yea that is simple :oops: thank you :D
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

i find that very annoying. please dont put that on any of your websites
User avatar
pedrotuga
Forum Contributor
Posts: 249
Joined: Tue Dec 13, 2005 11:08 pm

Post by pedrotuga »

I personaly dont see soooo much of a use for it... one can allways press ctrl+F.
But i guess is a mater of traffic you want to get. If you want traffic the recipit, despite hard to implement, is very simple: make you page usable for the stupidest audince you can imagine.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I don't plan on using it (as I find it sort of annoying too) but I still wanted to know how it's done (to put in my arsenal)
Post Reply