Friday, December 10, 2004

Allow EZ_Result to display +5Pages link

You can download ez_resuls.php from http://php.justinvincent.com/


Allow EZ_Result to display nav bar like this

365 Results: [start] 1 2 3 4 5 +5Pages [last]


For this to work, I added a few lines to the ez_results.php class as follows


/********************************************************

* NAVIGATION FORMATTING

*/

var $show_next_x_page = true;

var $text_hover_msg_next_x = '+NUMBER Pages';

var $text_next_x_page = '+NUMBER Pages';


In function build_navigation(), I added the following.


$current_page = ($_REQUEST['BRSR'] / $this->num_results_per_page) +1;

$page_left = $this->num_pages-$current_page ;



if($this->show_next_x_page)

if ( ($this->num_pages >= $this->num_browse_links) && (($_REQUEST['BRSR']
+ $this->num_results_per_page) < $this->num_results))

{

if(($page_left * $this->num_results_per_page >= $this->num_results
) || ($current_page * $this->num_results_per_page) < $this->num_results
)

{

if($page_left >= $this->next_x_pages){

$cur_a = $_REQUEST['BRSR'] + $this->num_results_per_page * $this->next_x_pages;

$out .= $this->create_link(preg_replace("/\?.*/",'',$_SERVER['PHP_SELF'])
. '?BRSR='. ($cur_a) .$this->qs,$this->merge_num('next_x_page',$this->next_x_pages),$this->merge_num('hover_msg_next_x',$this->next_x_pages),$this->get_style('next')).'
';

}

else{

$cur_a = $_REQUEST['BRSR'] + $this->num_results_per_page * $page_left;

$out .= $this->create_link(preg_replace("/\?.*/",'',$_SERVER['PHP_SELF'])
. '?BRSR='. ($cur_a) .$this->qs,$this->merge_num('next_x_page',$page_left),$this->merge_num('hover_msg_next_x',$page_left),$this->get_style('next')).'
';

}

}



}

No comments: