本文整理汇总了PHP中Members::list_articles_by_title_for_anchor方法的典型用法代码示例。如果您正苦于以下问题:PHP Members::list_articles_by_title_for_anchor方法的具体用法?PHP Members::list_articles_by_title_for_anchor怎么用?PHP Members::list_articles_by_title_for_anchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Members
的用法示例。
在下文中一共展示了Members::list_articles_by_title_for_anchor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_childs
/**
* list childs of this anchor, with or without type filters
*
* @param string set of desired childs (articles, sections...) separted by comma, or "all" keyword
* @param int offset to start listing
* @param int the maximum of items returned per type
* @param mixed string or object the layout to use
* @return an array of array with raw items sorted by type
*/
function get_childs($filter = 'all', $offset = 0, $max = 50, $layout = 'raw')
{
// we return a array
$childs = array();
// sub-categories
if ($filter == 'all' || preg_match('/\\bcategor(y|ies)\\b/i', $filter)) {
$childs['category'] = Categories::list_by_title_for_anchor($this, $offset, $max, $layout);
}
// related articles
if ($filter == 'all' || preg_match('/\\barticles?\\b/i', $filter)) {
$childs['article'] = Members::list_articles_by_title_for_anchor($this->get_reference(), $offset, $max, $layout);
}
// related sections
if ($filter == 'all' || preg_match('/\\bsections?\\b/i', $filter)) {
$childs['section'] = Members::list_sections_by_title_for_anchor($this->get_reference(), $offset, $max, $layout);
}
// related users
if ($filter == 'all' || preg_match('/\\busers?\\b/i', $filter)) {
$childs['user'] = Members::list_users_by_name_for_anchor($this->get_reference(), $offset, $max, $layout);
}
// files
if ($filter == 'all' || preg_match('/\\bfiles?\\b/i', $filter)) {
$childs['file'] = Files::list_by_title_for_anchor($this->get_reference(), $offset, $max, $layout);
}
return $childs;
}
示例2:
$items = Categories::list_by_title_for_anchor('category:' . $item['id'], 0, 50);
} else {
$items = Categories::list_by_date_for_anchor('category:' . $item['id'], 0, 50);
}
// actually render the html for the section
if ($items) {
$context['text'] .= $section . Skin::build_list($items, 'decorated');
}
//
// the section of linked articles
//
// title
$section = Skin::build_block(i18n::s('Pages'), 'title');
// list items by date (default) or by title (option articles_by_title)
if (preg_match('/\\barticles_by_title\\b/i', $item['options'])) {
$items =& Members::list_articles_by_title_for_anchor('category:' . $item['id'], 0, 50);
} else {
$items =& Members::list_articles_by_date_for_anchor('category:' . $item['id'], 0, 50);
}
// actually render the html for the section
if ($items) {
$context['text'] .= $section . Skin::build_list($items, 'decorated');
}
//
// the files section
//
// title
$section = Skin::build_block(i18n::s('Files'), 'title');
// list files by date (default) or by title (option :files_by_title:)
if (preg_match('/\\bfiles_by_title\\b/i', $item['options'])) {
$items = Files::list_by_title_for_anchor('category:' . $item['id'], 0, 300, 'category:' . $item['id']);
示例3: layout
/**
* list categories
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return plain text
$text = '';
// process all items in the list
while ($item = SQL::fetch($result)) {
// one box per category
$box['title'] = '';
$box['text'] = '';
// use the title to label the link
$box['title'] = Skin::strip($item['title'], 50);
// list related categories, if any
if ($items = Categories::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'category') . '</li>' . "\n";
}
}
// info on related sections
$items =& Members::list_sections_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'section') . '</li>' . "\n";
}
}
// info on related articles
if (isset($item['options']) && preg_match('/\\barticles_by_title\\b/i', $item['options'])) {
$items =& Members::list_articles_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
} else {
$items =& Members::list_articles_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
}
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'article') . '</li>' . "\n";
}
}
// info on related files
if (isset($item['options']) && preg_match('/\\bfiles_by_title\\b/i', $item['options'])) {
$items = Files::list_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'category:' . $item['id']);
} else {
$items = Files::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'category:' . $item['id']);
}
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'file') . '</li>' . "\n";
}
}
// info on related comments
include_once $context['path_to_root'] . 'comments/comments.php';
if ($items = Comments::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE, 'compact')) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label, 'comment') . '</li>' . "\n";
}
}
// info on related links
include_once $context['path_to_root'] . 'links/links.php';
if (isset($item['options']) && preg_match('/\\blinks_by_title\\b/i', $item['options'])) {
$items = Links::list_by_title_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
} else {
$items = Links::list_by_date_for_anchor('category:' . $item['id'], 0, COMPACT_LIST_SIZE);
}
if ($items) {
foreach ($items as $url => $label) {
if (is_array($label)) {
$label = $label[1];
}
$box['text'] .= '<li>' . Skin::build_link($url, $label) . '</li>' . "\n";
}
}
// add a direct link to the category
if (Surfer::is_associate()) {
$box['title'] .= ' ' . Skin::build_link(Categories::get_permalink($item), MORE_IMG, 'basic');
//.........这里部分代码省略.........
示例4: array
$layout_articles->set_focus('category:' . $item['id']);
// count the number of articles in this category
$count = Members::count_articles_for_anchor('category:' . $item['id'], $this_cat->get_listed_lang());
if ($count) {
$box['bar'] = array('_count' => sprintf(i18n::ns('%d page', '%d pages', $count), $count));
}
// navigation commands for articles
$home = Categories::get_permalink($item);
$prefix = Categories::get_url($item['id'], 'navigate', 'articles');
$box['bar'] = array_merge($box['bar'], Skin::navigate($home, $prefix, $count, ARTICLES_PER_PAGE, $zoom_index));
// list items by date (default) or by title (option 'articles_by_title') or by rating_sum (option article_by_rating)
$offset = ($zoom_index - 1) * ARTICLES_PER_PAGE;
if (isset($order) && preg_match('/\\barticles_by_rating\\b/i', $order)) {
$items =& Members::list_articles_by_rating_for_anchor('category:' . $item['id'], $offset, ARTICLES_PER_PAGE, $layout_articles, $this_cat->get_listed_lang());
} elseif (isset($item['options']) && preg_match('/\\barticles_by_title\\b/i', $item['options'])) {
$items =& Members::list_articles_by_title_for_anchor('category:' . $item['id'], $offset, ARTICLES_PER_PAGE, $layout_articles, $this_cat->get_listed_lang());
} else {
$items =& Members::list_articles_by_date_for_anchor('category:' . $item['id'], $offset, ARTICLES_PER_PAGE, $layout_articles, $this_cat->get_listed_lang());
}
// actually render the html for the section
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'decorated');
} elseif (is_string($items)) {
$box['text'] .= $items;
}
if ($box['bar']) {
$box['text'] .= Skin::build_list($box['bar'], 'menu_bar');
}
// in a separate panel
if ($box['text']) {
$panels[] = array('articles', i18n::s('Pages'), 'articles_panel', $box['text']);