当前位置: 首页>>代码示例>>PHP>>正文


PHP TravelHelper::paging_room方法代码示例

本文整理汇总了PHP中TravelHelper::paging_room方法的典型用法代码示例。如果您正苦于以下问题:PHP TravelHelper::paging_room方法的具体用法?PHP TravelHelper::paging_room怎么用?PHP TravelHelper::paging_room使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TravelHelper的用法示例。


在下文中一共展示了TravelHelper::paging_room方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_the_ID

 * Hotel loop room
 *
 * Created by ShineTheme
 *
 */
global $wp_query;
$post = STInput::request();
$post['room_parent'] = get_the_ID();
$hotel = new STHotel();
query_posts($hotel->search_room($post));
?>
    <ul class="booking-list loop-room">
        <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        echo st()->load_template('hotel/elements/loop-room-item');
    }
} else {
    echo st()->load_template('hotel/elements/loop-room-none');
}
?>

    </ul>
<div class="div_paged_room">
    <?php 
echo TravelHelper::paging_room();
?>
</div>
<?php 
wp_reset_query();
开发者ID:DaddyFool,项目名称:travelTest,代码行数:31,代码来源:loop_room.php

示例2: ajax_search_room

 function ajax_search_room()
 {
     if (st_is_ajax() and STInput::post('room_search')) {
         if (!wp_verify_nonce(STInput::post('room_search'), 'room_search')) {
             $result = array('status' => 0, 'data' => "");
             echo json_encode($result);
             die;
         }
         $result = array('status' => 1, 'data' => "");
         $hotel_id = get_the_ID();
         $post = STInput::request();
         $post['room_parent'] = $hotel_id;
         //Check Date
         $today = date('m/d/Y');
         $check_in = TravelHelper::convertDateFormat($post['start']);
         $check_out = TravelHelper::convertDateFormat($post['end']);
         $date_diff = TravelHelper::dateDiff($check_in, $check_out);
         $booking_period = intval(get_post_meta($hotel_id, 'hotel_booking_period', TRUE));
         $period = TravelHelper::dateDiff($today, $check_in);
         if ($booking_period && $period < $booking_period) {
             $result = array('status' => 0, 'data' => st()->load_template('hotel/elements/loop-room-none'), 'message' => sprintf(__('This hotel allow minimum booking is %d day(s)', ST_TEXTDOMAIN), $booking_period));
             echo json_encode($result);
             die;
         }
         if ($date_diff < 1) {
             $result = array('status' => 0, 'data' => "", 'message' => __('Make sure your check-out date is at least 1 day after check-in.', ST_TEXTDOMAIN), 'more-data' => $date_diff);
             echo json_encode($result);
             die;
         }
         add_filter('posts_where', array($this, '_alter_search_query_ajax'));
         $page = STInput::request('paged_room');
         if (!$page) {
             $page = get_query_var('paged_room');
         }
         $arg = array('post_type' => 'hotel_room', 'posts_per_page' => '10', 'paged' => $page, 'meta_query' => array(array('key' => 'room_parent', 'value' => $hotel_id, 'compare' => 'IN')));
         query_posts($arg);
         remove_filter('posts_where', array($this, '_alter_search_query_ajax'));
         global $wp_query;
         if (have_posts()) {
             while (have_posts()) {
                 the_post();
                 $result['data'] .= st()->load_template('hotel/elements/loop-room-item');
             }
         } else {
             $result['data'] .= st()->load_template('hotel/elements/loop-room-none');
         }
         $result['paging'] = TravelHelper::paging_room();
         wp_reset_query();
         echo json_encode($result);
         die;
     }
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:52,代码来源:class.hotel.php


注:本文中的TravelHelper::paging_room方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。