本文整理汇总了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;
}