Changeset 2440 for trunk/search.php
- Timestamp:
- 06/04/2010 09:10:20 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/search.php
r2436 r2440 11 11 global $page; 12 12 if ( !$page ) $page = 1; 13 $search_start = 5 * ( $page - 1); 14 $search_stop = 5; 13 $per_page = ceil( (int) bb_get_option( 'page_topics' ) / 2 ); 14 $search_start = $per_page * ( $page - 1 ); 15 $search_stop = $per_page; 15 16 16 17 /* Recent */ 17 18 add_filter( 'bb_recent_search_fields', create_function( '$f', 'return $f . ", MAX(post_time) AS post_time";' ) ); 18 19 add_filter( 'bb_recent_search_group_by', create_function( '', 'return "t.topic_id";' ) ); 19 $bb_query_form->BB_Query_Form( 'post', array(), array( 'order_by' => 'p.post_time', 'page' => 1, 'p ost_status' => 0, 'topic_status' => 0, 'post_text' => $q, 'forum_id', 'tag', 'topic_author', 'post_author' ), 'bb_recent_search' );20 $bb_query_form->BB_Query_Form( 'post', array(), array( 'order_by' => 'p.post_time', 'page' => 1, 'per_page' => -1, 'post_status' => 0, 'topic_status' => 0, 'post_text' => $q, 'forum_id', 'tag', 'topic_author', 'post_author' ), 'bb_recent_search' ); 20 21 $recent = $bb_query_form->results; 21 22 if ( $recent ) { … … 27 28 28 29 /* Relevant */ 29 $bb_query_form->BB_Query_Form( 'topic', array( 'search' => $q ), array( 'page' => 1, 'post_status' => 0, ' topic_status' => 0, 'search', 'forum_id', 'tag', 'topic_author', 'post_author' ), 'bb_relevant_search' );30 $bb_query_form->BB_Query_Form( 'topic', array( 'search' => $q ), array( 'page' => 1, 'post_status' => 0, 'per_page' => -1, 'topic_status' => 0, 'search', 'forum_id', 'tag', 'topic_author', 'post_author' ), 'bb_relevant_search' ); 30 31 $relevant = $bb_query_form->results; 31 if ( $re cent ) {32 if ( $relevant ) { 32 33 $relevant_count = isset( $bb_query_form->count ) ? $bb_query_form->count : count( $relevant ); 33 34 $relevant = array_slice( $relevant, $search_start, $search_stop ); … … 55 56 endif; 56 57 57 bb_load_template( 'search.php', array( 'q', 'recent', 'relevant', 'page', ' search_count' ), $q );58 bb_load_template( 'search.php', array( 'q', 'recent', 'relevant', 'page', 'per_page', 'search_count' ), $q ); 58 59 59 60 ?>
Note: See TracChangeset
for help on using the changeset viewer.