本文整理汇总了PHP中Search::range方法的典型用法代码示例。如果您正苦于以下问题:PHP Search::range方法的具体用法?PHP Search::range怎么用?PHP Search::range使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search::range方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
public function content()
{
echo '<div id="thumbnails">';
// generate a basic newest search with a range from 0 to 12
$s = new Search();
$s->order(SORT_NEWEST);
$s->range(0, 12);
$res = $s->search();
while ($image = $res->fetch_object()) {
echo $this->imageBlock($image);
}
echo '</div><div id="modal"></div><div id="modalContent"> </div>';
}
示例2: Search
require_once "./lib/Upload.php";
require_once "./lib/Search.php";
// we really don't want to have errors showing up here
if (!isset($_GET['debug'])) {
error_reporting(!E_ALL);
}
switch ($_GET['do']) {
/**
* This will fetch a full list of images
*/
case 'getImages':
$s = new Search();
// gets the range of our search
if (isset($_GET['offset'])) {
if (isset($_GET['count'])) {
$s->range($_GET['offset'], $_GET['count']);
} else {
$s->range($_GET['offset']);
}
} else {
if (isset($_GET['count'])) {
$s->range(NULL, $_GET['count']);
}
}
// sets our tags
if (isset($_GET['include'])) {
$tags = explode(',', $_GET['include']);
foreach ($tags as $k => $v) {
$tags[$k] = urldecode($v);
}
$s->with($tags);
示例3: Search
<body>
<div id="dialog">
<div class='content'></div>
</div>
<div id="menu"><h2>iZwei</h2>
<?php
echo $site->form(FORM_SIMPLESEARCH);
echo $site->form(FORM_UPLOAD);
?>
</div>
<div id="content">
<?php
// will be moved to design later on
$s = new Search();
$s->order(SORT_NEWEST);
$s->range(0, 12);
$res = $s->search();
while ($image = $res->fetch_object()) {
echo $site->imageBlock($image);
}
?>
</div>
<div id="modal">
</div>
<div id="modalContent"> </div>
</body>
<?php
$site->footer();
示例4: axSetSearch
function axSetSearch(Search $search)
{
// gets the range of our search
if (isset($_GET['offset'])) {
if (isset($_GET['count'])) {
$search->range($_GET['offset'], $_GET['count']);
} else {
$search->range($_GET['offset']);
}
} else {
if (isset($_GET['count'])) {
$search->range(NULL, $_GET['count']);
}
}
// sets our tags
if (isset($_GET['include'])) {
$tags = explode(',', $_GET['include']);
foreach ($tags as $k => $v) {
$tags[$k] = urldecode($v);
}
$search->with($tags);
}
if (isset($_GET['exclude'])) {
$tags = explode(',', $_GET['exclude']);
foreach ($tags as $k => $v) {
$tags[$k] = urldecode($v);
}
$search->without($tags);
}
// sets our order
if (isset($_GET['order'])) {
$orders = explode(',', $_GET['order']);
foreach ($orders as $key => &$o) {
switch ($o) {
case 'newest':
$o = SORT_NEWEST;
break;
case 'oldest':
$o = SORT_OLDEST;
break;
case 'best':
$o = SORT_POPULARITY;
break;
case 'worst':
$o = SORT_IMPOPULARITY;
break;
case 'random':
$o = SORT_RANDOM;
break;
case 'mosttags':
$o = SORT_MORETAGS;
break;
case 'leasttags':
$o = SORT_LESSTAGS;
break;
default:
trigger_error("Sort mode {$o} is not supported!", E_USER_NOTICE);
}
}
$search->order($orders);
}
return $search;
}