1. Trang chủ >
  2. Công Nghệ Thông Tin >
  3. Quản trị mạng >

Hack 94. Search Your Web Site with Yahoo!

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (15.01 MB, 888 trang )


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



Xem Thêm
Tải bản đầy đủ (.pdf) (888 trang)

×