本文整理汇总了PHP中search::get_position_within_album方法的典型用法代码示例。如果您正苦于以下问题:PHP search::get_position_within_album方法的具体用法?PHP search::get_position_within_album怎么用?PHP search::get_position_within_album使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search
的用法示例。
在下文中一共展示了search::get_position_within_album方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_display_context
static function get_display_context($item, $album_id, $title, $query_terms, $q)
{
$album = ORM::factory("item", $album_id);
$position = search::get_position_within_album($item, $query_terms, $album);
if ($position > 1) {
list($count, $result_data) = search::search_within_album($query_terms, $album, 3, $position - 2);
list($previous_item, $ignore, $next_item) = $result_data;
} else {
$previous_item = null;
list($count, $result_data) = search::search_within_album($query_terms, $album, 1, $position);
list($next_item) = $result_data;
}
$search_url = url::abs_site("search" . "?q=" . urlencode($q) . "&album=" . urlencode($album_id) . "&show={$item->id}");
$root = item::root();
return array("position" => $position, "previous_item" => $previous_item, "next_item" => $next_item, "sibling_count" => $count, "breadcrumbs" => array(Breadcrumb::instance($root->title, "/", $root->id)->set_first(), Breadcrumb::instance(t("Search: %q", array("q" => $q)), $search_url), Breadcrumb::instance($item->title, $item->url())->set_last()));
}
示例2: get_position
static function get_position($item, $q)
{
return search::get_position_within_album($item, $q, item::root());
}