當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Services::setLimitOffset方法代碼示例

本文整理匯總了PHP中Services::setLimitOffset方法的典型用法代碼示例。如果您正苦於以下問題:PHP Services::setLimitOffset方法的具體用法?PHP Services::setLimitOffset怎麽用?PHP Services::setLimitOffset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Services的用法示例。


在下文中一共展示了Services::setLimitOffset方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: smarty_block_feed

/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2075 $
 */
function smarty_block_feed($params, $content, &$smarty, &$repeat)
{
    $conditions = array();
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "feed";
    }
    if (class_exists("Services")) {
        $service = new Services();
        $service_controller = new Service();
    } else {
        uses("service");
        $service = new Services();
        $service_controller = new Service();
    }
    $orderby = array();
    require CACHE_PATH . "cache_type.php";
    if (isset($params['type'])) {
        $conditions[] = "type='" . $params['type'] . "'";
    }
    if (isset($params['typeid'])) {
        $conditions[] = "type_id='" . $params['typeid'] . "'";
    }
    if (isset($params['id'])) {
        $conditions[] = "id='" . $params['id'] . "'";
    }
    if (isset($params['orderby'])) {
        $orderby[] = trim($params['orderby']);
    } else {
        $orderby[] = "id DESC ";
    }
    $service->setOrderby($orderby);
    $service->setCondition($conditions);
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $service->setLimitOffset($offset, $limit);
    $sql = "SELECT * FROM {$service->table_prefix}feeds  " . $service->getCondition() . $service->getOrderby() . $service->getLimitOffset();
    $result = $service->GetArray($sql);
    $return = $link_title = null;
    if (!empty($result)) {
        $i_count = count($result);
        for ($i = 0; $i < $i_count; $i++) {
            $data = unserialize($result[$i]['data']);
            foreach ($data as $val) {
                $link_title .= $val;
            }
            $return .= str_replace(array("[link:title]"), array($link_title), $content);
        }
    }
    return $return;
}
開發者ID:renduples,項目名稱:alibtob,代碼行數:62,代碼來源:block.feed.php


注:本文中的Services::setLimitOffset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。