Changeset 2440
- Timestamp:
- 06/04/2010 09:10:20 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bb-includes/functions.bb-template.php
r2437 r2440 1643 1643 } 1644 1644 1645 function bb_search_pages() { 1646 global $page, $search_count; 1647 echo apply_filters( 'bb_search_pages', get_page_number_links( array( 'page' => $page, 'total' => $search_count, 'per_page' => 5, 'mod_rewrite' => false ) ) ); 1645 function bb_search_pages( $args = null ) { 1646 global $page, $search_count, $per_page; 1647 1648 $defaults = array( 'before' => '', 'after' => '' ); 1649 $args = wp_parse_args( $args, $defaults ); 1650 1651 if ( $pages = apply_filters( 'bb_search_pages', get_page_number_links( array( 'page' => $page, 'total' => $search_count, 'per_page' => $per_page, 'mod_rewrite' => false ) ) ) ) 1652 echo $args['before'] . $pages . $args['after']; 1648 1653 } 1649 1654 -
trunk/bb-templates/kakumei/search.php
r2436 r2440 15 15 <li<?php alt_class( 'recent' ); ?>> 16 16 <a class="result" href="<?php post_link(); ?>"><?php echo bb_show_topic_context( $q, get_topic_title( $bb_post->topic_id ) ); ?></a> 17 <span class="freshness"><?php printf( __( ' Posted by <a href="%1$s">%2$s</a> on %3$s'), get_user_profile_link( $bb_post->poster_id ), get_post_author(), bb_datetime_format_i18n( bb_get_post_time( array( 'format' => 'timestamp' ) ) ) ); ?></span>17 <span class="freshness"><?php printf( __( 'By <a href="%1$s">%2$s</a> on %3$s'), get_user_profile_link( $bb_post->poster_id ), get_post_author(), bb_datetime_format_i18n( bb_get_post_time( array( 'format' => 'timestamp' ) ) ) ); ?></span> 18 18 <p><?php echo bb_show_context( $q, $bb_post->post_text ); ?></p> 19 19 </li> … … 28 28 <ol> 29 29 <?php foreach ( $relevant as $topic ) : ?> 30 <?php $bb_post = bb_get_first_post( $topic ); ?> 30 31 <li<?php alt_class( 'relevant' ); ?>> 31 <a class="result" href="<?php post_link( $topic->post_id); ?>"><?php echo bb_show_topic_context( $q, get_topic_title() ); ?></a>32 <span class="freshness"><?php printf( __( ' Posted by <a href="%1$s">%2$s</a> on %3$s' ), get_user_profile_link( $topic->topic_id), get_topic_author(), bb_datetime_format_i18n( get_topic_start_time( array( 'format' => 'timestamp' ) ) ) ); ?></span>33 <p><?php echo bb_show_context( $q, $ topic->post_text ); ?></p>32 <a class="result" href="<?php post_link(); ?>"><?php echo bb_show_topic_context( $q, get_topic_title() ); ?></a> 33 <span class="freshness"><?php printf( __( 'By <a href="%1$s">%2$s</a> on %3$s' ), get_user_profile_link( $topic->topic_poster ), get_topic_author(), bb_datetime_format_i18n( get_topic_start_time( array( 'format' => 'timestamp' ) ) ) ); ?></span> 34 <p><?php echo bb_show_context( $q, $bb_post->post_text ); ?></p> 34 35 </li> 35 36 <?php endforeach; ?> … … 38 39 <?php endif; ?> 39 40 41 <?php bb_search_pages( array( 'before' => '<div class="nav">', 'after' => '</div>' ) ); ?> 42 40 43 <?php if ( $q && !$recent && !$relevant ) : ?> 41 44 <p><?php printf( __( 'Your search %s did not return any results. Here are some suggestions:' ), '“<em>' . esc_html( $q ) . '</em>”' ); ?></p> 42 45 <ul id="search-suggestions"> 43 44 45 46 <li><?php _e( 'Make sure all words are spelled correctly' ); ?></li> 47 <li><?php _e( 'Try different keywords' ); ?></li> 48 <li><?php _e( 'Try more general keywords' ); ?></li> 46 49 </ul> 47 <?php else: ?>48 <?php bb_search_pages(); ?>49 <br />50 50 <?php endif; ?> 51 51 -
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.