本文整理汇总了PHP中Ad::get_all方法的典型用法代码示例。如果您正苦于以下问题:PHP Ad::get_all方法的具体用法?PHP Ad::get_all怎么用?PHP Ad::get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ad
的用法示例。
在下文中一共展示了Ad::get_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
$r = (int) $_GET['r'];
if ($r != 0) {
$r = 1;
}
$a['sponsored'] = $r;
$a['sponsoredon'] = $r = 0 ? '' : date('Y-m-d', time());
Ad::update($o, $a);
}
$tct = Ad::count();
//total count
$rpp = 10;
//row per page
$pager_options = array('mode' => 'Sliding', 'perPage' => $rpp, 'delta' => 2, 'totalItems' => $tct, 'excludeVars' => array('o', 'r', 'd', 't', 'e'));
$pager = @Pager::factory($pager_options);
list($from, $to) = $pager->getOffsetByPageId();
$ads = Ad::get_all(array(), '', $from - 1 . ", {$rpp}");
include "page-header.php";
?>
<div id="wrapper">
<?php
include "page-left.php";
?>
<div id="content">
<?php
if ($tct > $rpp) {
echo $pager->links . '<br /><br />';
}
示例2: AND
$or_filter .= " OR id LIKE '{$gs_description}'";
}
if ($or_filter != '') {
$filter .= " AND (1=2 {$or_filter})";
}
if ($g_category != "any" && $g_category != '0') {
$filter .= " AND (category=(SELECT r.id FROM category r WHERE r.slug='{$g_category}' LIMIT 1) OR category IN (SELECT r.id FROM category r WHERE r.parent=(SELECT s.id FROM category s WHERE s.slug='{$g_category}' LIMIT 1)))";
}
if ($g_region != "any" && $g_region != '0') {
$filter .= " AND (region=(SELECT r.id FROM region r WHERE r.slug='{$g_region}' LIMIT 1) OR region IN (SELECT r.id FROM region r WHERE r.parent=(SELECT s.id FROM region s WHERE s.slug='{$g_region}' LIMIT 1)))";
}
if ($g_min_price != "") {
$filter .= " AND ar>={$g_min_price}";
}
if ($g_max_price != "") {
$filter .= " AND ar<={$g_max_price}";
}
if ($g_id > 0) {
$filter .= " AND id='{$g_id}'";
}
}
$rpp = 15;
//row per page
$tct = Ad::count(array(), $filter);
//total count
$pager_options = array('mode' => 'Sliding', 'perPage' => $rpp, 'delta' => 2, 'totalItems' => $tct);
$pager = @Pager::factory($pager_options);
list($from, $to) = $pager->getOffsetByPageId();
$ads = Ad::get_all(array(), $filter, $from - 1 . ", {$rpp}");
$curr_page = "home";
include "./templates/ad-list.php";
示例3: get_all
/**
* Get user's all favourite ads
*
* @param int $user_id The user's id.
* @param int $limit Number of rows needs to be returned.
* @return array The result rows as array.
*/
public static function get_all($user_id, $limit)
{
global $db;
$filter = sprintf("h.active=1 AND h.id IN (SELECT f.ad_id FROM " . static::$table_name . " f WHERE f.user_id=%d)", $user_id);
return Ad::get_all(array(), $filter, $limit);
}