PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   How-to Forum (http://www.phpdig.net/forum/forumdisplay.php?f=33)
-   -   refine search to two or more urls (http://www.phpdig.net/forum/showthread.php?t=2636)

fmehl 09-30-2006 10:05 PM

refine search to two or more urls
 
Hi, I'm new to Phpdig (and PHP in general), but I was wondering if it's possible to search two or more sites at a time, but not all of the ones included in the spider.

What I'm hoping to do is change the dropdown list to checkboxes, where users can choose whichever sites they want to search. I've been looking at function_phpdig_form but am having trouble with it. I don't know how to pass two or more siteids to the search query.

Any advice is much appreciated. Thanks!

Charter 10-01-2006 07:50 AM

PhpDig is really set to search all sites or one site at a time. The $site varaible is what determines the site to search and can be in a query string, hidden field, or option tag. To get $site set and treated as an array of integers rather than one integer...

Here are the areas in search_functions.php that may have to be changed:
  • Code:

    if (mb_eregi("^[0-9]+[,]",$site)) {
        $tempbust = explode(",",$site);
        $site = $tempbust[0];
        $path = $tempbust[1];
    }
    settype($site,'integer'); // now set to integer

  • Code:

        $wheresite = "AND spider.site_id = $site ";
  • Code:

        $refine_url = "&refine=1&site=$site&path=".urlencode($path);
And here are the areas in function_phpdig_form.php that may have to be changed:
  • Code:

        if (isset($site) && is_numeric($site) && ($site > 0)) {
            $site = (int) $site;

  • Code:

                'WHERE '.PHPDIG_DB_PREFIX.'sites.site_id = '.$site.' '.
  • Code:

                $dd_query = mysql_query('SELECT DISTINCT path FROM '.PHPDIG_DB_PREFIX.'spider WHERE site_id = '.$site.' AND path != ""',$id_connect);
  • Code:

                <input type='hidden' name='site' value='$site'/>
  • Code:

              $result['form_dropdown'] .= "<option value='".$dd_data['site_id'].",".$dd_data['path']."'>".$dd_data['site_url'].$dd_data['path']."</option>";
  • Code:

      <input type='hidden' name='site' value='$site'/>
There may be other areas also, and of course the search form would need to be altered to allow for muli-selects. Also, the areas above don't take into account the changes that might be needed for selected or checked remembrance after a search.

fmehl 10-01-2006 12:52 PM

Thanks!!! I'll give it a try.


All times are GMT -8. The time now is 07:44 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.