PhpDig.net

Go Back   PhpDig.net > PhpDig Forums > Troubleshooting

Reply
 
Thread Tools
Old 09-02-2004, 02:57 PM   #1
passweb
Green Mole
 
Join Date: Aug 2004
Posts: 3
Problem using custom search result page

Greetings,

I'm trying to fit PhpDig into my CMS. Right now the indexing is working perfectly, and my search.php works flawlessly. The problem, however, is that I am trying to use a php CMS I have developed to display the search results, not the original search.php script. When I do a search, my script (which is almost identical to the search.php one, except using an array rather than a template) says that there are no search results. search.php, on the other hand, gives me plenty of results. It's like it gives me different results depending on which php page is requesting it.
Here is the code for the page that is giving me problems (this code is stored in a database, then eval'ed by my CMS):
PHP Code:
<?php
if (isset($_REQUEST['query_string'])) {
$relative_script_path './phpdig';
$no_connect 0;

if (
is_file("$relative_script_path/includes/config.php")) {
    include 
"$relative_script_path/includes/config.php";
}
else {
    die(
"Cannot find config.php file.\n");
}

if (
is_file("$relative_script_path/libs/search_function.php")) {
    include 
"$relative_script_path/libs/search_function.php";
}
else {
   die(
"Cannot find search_function.php file.\n");
}

// extract vars
extract(phpdigHttpVars(
     array(
'query_string'=>'string',
           
'refine'=>'integer',
           
'refine_url'=>'string',
           
'site'=>'string'// set to integer later
           
'limite'=>'integer',
           
'option'=>'string',
           
'lim_start'=>'integer',
           
'browse'=>'integer',
           
'path'=>'string'
           
)
     ));

$search=phpdigSearch($id_connect$query_string$option$refine,
              
$refine_url$lim_start$limite$browse,
              
0$path$relative_script_path'array','');

if (
strtolower($search[result_message]) != 'noresults') {
  
$results $search[results];
  unset(
$search[results]);
  
$nav_bar str_replace('search.php?','./?id=new_search&',$search[nav_bar]);
  echo(
'<div align="center"><strong>'.$search[result_message].'</strong><br/>'.$nav_bar.'</div>');
  echo(
'<table class="searchTable">');
  foreach(
$results as $x)
  {
    
// this checks for binary data, and fixes the name so it looks like
    
$name $x[link_title];
    if ( 
substr($name,0,14)=='binarydata.php')
    {
      
$loc_f strpos($name,"&n=")+3;
      
$filename urldecode(substr($name,$loc_f,strlen($name)-$loc_f));
      
$loc_id strpos($name,"?id=")+4;
      
$fid substr($name,$loc_id,$loc_f-$loc_id-3);
      
$name $fid ": " .$filename;
      echo(
'<tr><td class="searchTitle"><a href="./?id='.$fid.'">'.get_frame_title($fid).'</a> : <a href="'.$x[complete_path].'">'.$filename.'</a> ('.$x[weight].')</td></tr>');
    } else { 
// ok its a real page, not binary data
      
echo('<tr><td class="searchTitle"><a href="'.$x[complete_path].'">'.$name.'</a> ('.$x[weight].')</td></tr>');
    }
    echo(
'<tr><td>'.preg_replace('/('.preg_quote($query_string).')/i','<span style="color: Red;">1</span>'$x[text]).'</td></tr>');
    echo(
'<tr><td> </td></tr>'); // spacer row
  
}
  echo(
'</table><br />');
  echo(
'<div align="center">'.$nav_bar.'</div>');
} else {
  echo(
'Sorry, there were no results for your search. Please refine your query.');
}


} else {
echo(
'No search terms specified.');
}
  
?>
<br />
<br />
<div align="center">Uses <a href="http://www.phpdig.net/">PhpDig</a> Search Technology</div>
Any help would be greatly appreciated. I've followed the examples and instructions that were in a number of threads here, so I think I've modified things so that it should work by now.

(I think I've fixed the paths, which were earlier giving me trouble... right now the dir structure looks like:

/default.php (which takes ?id= and presents whichever page in the cms was requested, eg: default.php?id=search_results)
/search.php (which I wish to not have to use but is still working)
/phpdig/ (the phpdig dir)

Last edited by passweb; 09-02-2004 at 03:02 PM.
passweb is offline   Reply With Quote
Old 09-07-2004, 04:42 PM   #2
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Hi. What is the exact message you receive?
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Old 09-13-2004, 02:02 PM   #3
passweb
Green Mole
 
Join Date: Aug 2004
Posts: 3
Quote:
Originally Posted by Charter
Hi. What is the exact message you receive?
Quote:
Sorry, there were no results for your search. Please refine your query.
is what is returned.
passweb is offline   Reply With Quote
Old 09-13-2004, 02:18 PM   #4
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
In the language pack is 'noresults' =>'No results' so try changing if (strtolower($search[result_message]) != 'noresults') to if (strtolower($search[result_message]) != 'no results') and see if it works.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Old 09-13-2004, 03:44 PM   #5
passweb
Green Mole
 
Join Date: Aug 2004
Posts: 3
Quote:
Originally Posted by Charter
In the language pack is 'noresults' =>'No results' so try changing if (strtolower($search[result_message]) != 'noresults') to if (strtolower($search[result_message]) != 'no results') and see if it works.
Thanks for the quick reply! Unfortunately, that did not work. The $search[result_message] is 'noresults' with no space. Any other ideas?
passweb is offline   Reply With Quote
Old 09-13-2004, 11:43 PM   #6
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
It would seem then that if (strtolower($search[result_message]) != 'noresults') or rather $search[result_message] is always being returned as 'noresults' a check of whatever mods you made to the search_function.php file might lend a clue.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search Result Page Question b-online How-to Forum 2 03-28-2005 01:03 PM
Automatic Webpage Thumbnails In Search Result Page JWSmythe Mod Submissions 6 08-24-2004 12:01 PM
search result destroys page layout... Chris2 Troubleshooting 1 02-11-2004 12:17 PM
empty search info on the result page 123av Troubleshooting 6 11-15-2003 05:09 PM
problems on the first result page with multiple search strings heiko Troubleshooting 3 10-15-2003 05:06 AM


All times are GMT -8. The time now is 02:00 PM.


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