Tải bản đầy đủ - 0 (trang)
Hack 94. Search Your Web Site with Yahoo!

Hack 94. Search Your Web Site with Yahoo!

Tải bản đầy đủ - 0trang

PepsiCo,Inc.(theownersandoperatorsof

http://www.mountaindew.com)probablyhasthebudgetand

teamofdeveloperstobuilditsownsearchengineforthesiteif

itwantedto.Butmanyindividualsandsmallbusinessesdon't

havethatluxury.SinceYahoo!isprobablyalreadyindexingany

pagesyouhaveontheWeb,youcouldeasilygiveyourreaders

ashortcuttosearchingyoursitewithacustomYahoo!search

form.



6.4.1.TheCode

Inadditiontothesite:metakeyword,sometweakstoa

standardYahoo!WebSearchURLwillalsolimitresultstoa

singledomain.Here'sasearchURLthatwillreturnthesame

resultsasthepreviousexample:





http://search.yahoo.com/search?p=calories&vs=mountainde



Asyoucansee,thepquerystringvariableholdsthesearch

queryandthevsvariableindicatesthedomaintolimitthe

searchresultsto.Armedwiththisinformation,here'sabitof

HTMLthatwillbuildtheproperURL:




































Searchtheweb




value="insertyourdomain"checked="checked"/>



Searchthissite






6.4.2.RunningtheHack

Allyouneedtodotocustomizethecodeisinsertyourdomain

nameinthesecondradioinputtag.YoucanaddthisHTMLto

anyexistingwebpagetoprovideyourreaderswithawayto

searchyoursite.Inabrowser,theresultlookslikeFigure6-4.



Figure6-4.CustomYahoo!searchform



The"Searchthissite"optionwillbeselectedbydefault,but

userscouldalsosearchtheentireWebfromtheform.Whilethis

won'tmakeyoursiteasextremeas

http://www.mountaindew.com,atleastyourvisitorswillbeable

tofindexactlywhatthey'reafter.



Hack95.AddPresencetoYourWebSite



Letyourvisitorsknowwhenyou'reonlinebyconnecting

yoursitetoYahoo!Messenger.

TheWebisgreatforasynchronouscommunication.Thatis,I

canpostsomethingtomywebsiteat4:00a.m.,andyoucan

readwhatI'vewrittenatanypointafterthat.Wedon'tneedto

besittingatourcomputersatthesametimetoshare

information.However,ifbothofuswanttohavearealtimetext

conversationsimilartoatelephonecoversation,buttypedrather

thanspokentheWebdoesn'tworknearlyaswell,andthat's

whereinstantmessagingcanhelp.

Yahoo!InstantMessengerisaprogramthatletsyou

communicatewithotherpeopleinrealtime.Ifyouandafriend

bothhaveYahoo!InstantMessengerandyou'rebothatyour

respectivecomputersatthesametime,youcansendmessages

backandforthinstantly.Theprogramletsyousetastatusthat

letsothersknowwhetheryou'recurrentlyavailable.Thisstatus,

orpresence,isavailableonlytopeoplewhohaveyouontheir

Yahoo!InstantMessengerfriendslistandwhohavethe

programopen.ButwithsomesimpleHTML,youcanmakeyour

presenceknowntoanyonebrowsingyourwebsite.

Yahoo!hasopenedabackdoortothecurrentonlinestatusof

Yahoo!members,calledtheOnlinePresenceIndicator.Thanks

toapredictableimageURL,youcandisplayagraphiconyour

websitethattellspeoplewhetheryou'reavailabletochat.If

oneofyourreadersalsohasYahoo!InstantMessenger,he'llbe

abletoclickthegraphictosendyouaninstantmessage.

Theonlythingyou'llneedtorunthishackisacopyofYahoo!



InstantMessenger(http://messenger.yahoo.com).You'llalso

needtobesurethatyourYahoo!Profileallowsotherstoview

youronlinestatus.Toverifythatotherscanviewyouronline

status,gotohttp://edit.profiles.yahoo.com/config/edit_identity

andmakesurethattheboxto"hidemyonlinestatus"is

unchecked,asshowninFigure6-5.



6.5.1.TheCode

Ifyouwantthelightning-fastwaytoaddpresencetoyourweb

site,Yahoo!offerssomecut-and-pasteHTMLat

http://messenger.yahoo.com/messenger/help/online.html.But

bytakingsometimetounderstandhowtoputtogetheryour

ownpresenceHTML,youcancustomizethelookofthe

presenceindicatorandgetittobehavethewayyouwantitto.



Figure6-5.Yahoo!Profilesettingtohideonline

status



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Hack 94. Search Your Web Site with Yahoo!

Tải bản đầy đủ ngay(0 tr)

×