View Single Post
Old 01-21-2005, 06:19 PM   #2
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
The SEARCH_DEFAULT_LIMIT constant in the config file can only understand 10, 30, or 100 as a value, but this is not noted in the config file. If you should happen to set SEARCH_DEFAULT_LIMIT to 20 for example, then you will get an "undefined offset" notice when error reporting is on high. To allow SEARCH_DEFAULT_LIMIT to take on values other than 10, 30, or 100, do the following:

In function_phpdig_form.php find:
Code:
$limit10 = array(10 => 'selected="selected"', 30=> '', 100=> '');
$limit30 = array(10 => '', 30=> 'selected="selected"', 100=> '');
$limit100 = array(10 => '', 30=> '', 100=> 'selected="selected"');
And afterwards add:
Code:
$limitopt_flag = 0;
if (!in_array(SEARCH_DEFAULT_LIMIT,array(10,30,100))) {
    $limitopt_flag = 1;
    $limit10[SEARCH_DEFAULT_LIMIT] = "";
    $limit30[SEARCH_DEFAULT_LIMIT] = "";
    $limit100[SEARCH_DEFAULT_LIMIT] = "";
    $limitdef = array(10 => '', 30=> '', 100=> '', SEARCH_DEFAULT_LIMIT=> 'selected="selected"');
    $limitoptdef = "<option ".$limitdef[$limite].">".SEARCH_DEFAULT_LIMIT."</option>";
}

$limitopt10 = "<option ".$limit10[$limite].">10</option>";
$limitopt30 = "<option ".$limit30[$limite].">30</option>";
$limitopt100 = "<option ".$limit100[$limite].">100</option>";

$limitselectopts = array(10=>$limitopt10, 30=>$limitopt30, 100=>$limitopt100);

if ($limitopt_flag == 1) {
    $limitselectopts[SEARCH_DEFAULT_LIMIT] = $limitoptdef;
    ksort($limitselectopts);
}

$selectoptlist = "";
foreach($limitselectopts as $selectopt) {
    $selectoptlist .= $selectopt;
}
Also, in function_phpdig_form.php find:
Code:
<option ".$limit10[$limite].">10</option>
<option ".$limit30[$limite].">30</option>
<option ".$limit100[$limite].">100</option>
And replace with:
Code:
$selectoptlist
If you downloaded PhpDig v.1.8.7 after the date of this post, the changes in this post have already been applied to the package.
__________________
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