I found the PHP Ajax Live Search code here > http://www.w3schools.com/php/php_ajax_livesearch.asp

I edited an rss/xml feed for recent listings from a php directory I use the same as the links.xml file example they give & got it working > http://www.easysavannah.com/livesearch.html

Problem is I cannot get it to search the "description", only the "title" & "url". The "livesearch.php" listed here >> http://www.w3schools.com/php/php_ajax_livesearch.asp seems to mirror in ways the php for the MSN Live Search API code > http://dev.live.com/blogs/livesearch/archive/2009/01/08/445.aspx

w3school's code snippet:

$hint="";
for($i=0; $i<($x->length); $i++)
{
$y=$x->item($i)->getElementsByTagName('title');
$z=$x->item($i)->getElementsByTagName('url');
if ($y->item(0)->nodeType==1)
{
//find a link matching the search text
if (stristr($y->item(0)->childNodes->item(0)->nodeValue,$q))
{
if ($hint=="")
{
$hint="<a href='" .
$z->item(0)->childNodes->item(0)->nodeValue .
"' target='blank'>" .
$y->item(0)->childNodes->item(0)->nodeValue . "</a>";
}
else
{
$hint=$hint . "<br /><a href='" .
$z->item(0)->childNodes->item(0)->nodeValue .
"' target='
blank'>" .
$y->item(0)->childNodes->item(0)->nodeValue . "</a>";

MSN Live Search php snippett:

echo('<li class="resultlistitem"><a href="' . $value->childNodes->item(2)->nodeValue . '">'); //Url echo('<h3>' . $value->childNodes->item(0)->nodeValue . '</h3></a>'); //Title echo('<p>' . $value->childNodes->item(1)->nodeValue . '</p>'); //Description } echo("</ul>");

I've tried a multitude of ways to add an echo into "w3"s code for allowing the code to search a description in an xml page.

Has anyone seen a solution for this? Any help would be appreciated. Thanks, Gene

PS. Code sample on index page of directory I'm testing > http://www.easysavannah.com/index2.html (middle below header)

    2 years later
    gene99;10934351 wrote:

    I have an answer, thanks

    Hello! I have a similar situation with this particular code... can you provide me a hint?
    thanks!
    btw: nice job! you´ve done a great webpage!
    Greetings from Argentina!
    Nicolas

      Finally got it... thanks anyway!😃

        Good luck with it. Sorry I just got your post this morning.

          Write a Reply...