当前位置: 首页>>代码示例>>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;未经允许,请勿转载。