Skip to main content
Published: October 11 2007, 9:49:00 PMUpdated: November 28 2020, 4:01:03 PM

How can I make my Editor Kit search term contextual and dynamic?

How can I make my Editor Kit search term contextual and dynamic?

Detailed Description

The search term used for Editor Kit can be dynamic.
In order to make the search results relevant to the context of any given web page, the following techniques can be used.

  • Build the script tag using JavaScript
    var mySearchTerm = "MyDynamicSearchTerm";
    document.write("<script language='JavaScript' src='http://lapi.ebay.com/ws/eBayISAPI.dll?EKServer&ai=k%7Cv%7Etffrzta&bdrcolor=666666&cid=0&eksize=5&encode=ISO-8859-1&endcolor=FF0000&endtime=y&fbgcolor=EFEFEF&fntcolor=000000&fs=0&gallery=y&hdrcolor=FFFFCC&hdrimage=7&hdrsrch=n&img=y&lnkcolor=0000FF&logo=9&num=25&numbid=y&paypal=n&popup=y&prvd=1&query=" + mySearchTerm + "&r0=4&shipcost=n&sid=test&siteid=0&sort=MetaEndSort&sortby=endtime&sortdir=asc&srchdesc=n&tbgcolor=FFFFFF&tlecolor=990000&tlefs=0&tlfcolor=FFFFFF&track=77777777&width=570'></script>");

    This will create the script tag on the page that, when loaded in the client browser, will make the Editor Kit request using the contents of the javascript string variable named "mySearchTerm" as the search term.  As with any javascript variable, the search term can be generated on the server or during the loading of the page on the browser client.
  • PHP - Use the echo statement
    echo "<script language='JavaScript' src='http://lapi.ebay.com/ws/eBayISAPI.dll?EKServer&ai=k%7Cv%7Etffrzta&bdrcolor=666666&cid=0&eksize=5&encode=ISO-8859-1&endcolor=FF0000&endtime=y&fbgcolor=EFEFEF&fntcolor=000000&fs=0&gallery=y&hdrcolor=FFFFCC&hdrimage=7&hdrsrch=n&img=y&lnkcolor=0000FF&logo=9&num=25&numbid=y&paypal=n&popup=y&prvd=1&query=" . $MyDynamicSearchTerm . "&r0=4&shipcost=n&sid=test&siteid=0&sort=MetaEndSort&sortby=endtime&sortdir=asc&srchdesc=n&tbgcolor=FFFFFF&tlecolor=990000&tlefs=0&tlfcolor=FFFFFF&track=77777777&width=570'></script>";

    The contents of the PHP variable named "MyDynamicSearchTerm" will be used as the search term in the Editor Kit request.

How well did this answer your question?
Answers others found helpful