PDA

View Full Version : Bug in the "refine" feature


laurentxav
03-01-2004, 03:26 AM
Hello,

I've found a little bug in the "refine" feature in the last version (1.8.0).

When you want to search a specific path of your site, you've to add some hidden fields in the search form:
<input type="hidden" name="site" value="YourSiteIDHere">
<input type="hidden" name="path" value="YourPathHere">
<input type="hidden" name="refine" value="1">


Then, in the result page, PhpDig show the results found in "YourPathHere" folder.
But if you do a new search now, PhpDig'll ignore the "YourPathHere" because de refine value is lost.

To correct this, you've to modify the following files :
1) /libs/search_function.php
modify line ~577
$t_fstrings = phpdigMakeForm($query_string,$option,$limite,SEARCH_PAGE,$site,$path,'templ ate',$template);
replace by :
$t_fstrings = phpdigMakeForm($query_string,$option,$limite,SEARCH_PAGE,$site,$path,'templ ate',$template,$refine);
modify line ~605
phpdigMakeForm($query_string,$option,$limite,SEARCH_PAGE,$site,$path);
replace by :
phpdigMakeForm($query_string,$option,$limite,SEARCH_PAGE,$site,$path,$refin e);
modify line ~632
phpdigMakeForm($query_string,$option,$limite,SEARCH_PAGE,$site,$path);
replace by :
phpdigMakeForm($query_string,$option,$limite,SEARCH_PAGE,$site,$path,$refin e);

2) /libs/function_phpdig_form.php
modifiy the first line code (~line 20)
function phpdigMakeForm($query_string="",$option="start",$limite=10,$result_page="index.php",
$site="",$path="",$mode='classic',$template="")
replace by :
function phpdigMakeForm($query_string="",$option="start",$limite=10,$result_page="index.php",
$site="",$path="",$mode='classic',$template="",$refine=0)
in the block line ~39
$result['form_head'] = "<form action='$result_page' method='get'>
<input type='hidden' name='site' value='$site'/>
<input type='hidden' name='path' value='$path'/>
<input type='hidden' name='result_page' value='$result_page'/>
";
add a line :
$result['form_head'] = "<form action='$result_page' method='get'>
<input type='hidden' name='site' value='$site'/>
<input type='hidden' name='path' value='$path'/>
<input type='hidden' name='result_page' value='$result_page'/>
<input type='hidden' name='refine' value='$refine'/>
";
Now, PhpDig consider de refine feature and show result in the specified path.
It works for me but if I'm wrong, Charter, please correct me ! ;)

Laurent

Charter
03-01-2004, 08:32 AM
Hi. Moved to Mod Submissions as it's a mod of a mod but not part of the original code. ;)

Once $refine is set to one, do you have an option to set it back to zero, or to reset $path to start a new search of the same site?

The code in this (http://www.phpdig.net/showthread.php?threadid=580) thread may be of interest.