本文整理汇总了PHP中Articles::list_for_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Articles::list_for_name方法的具体用法?PHP Articles::list_for_name怎么用?PHP Articles::list_for_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Articles
的用法示例。
在下文中一共展示了Articles::list_for_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: join
$lines[] = Skin::build_link($context['url_to_home'] . $context['url_to_root'] . Files::get_url('article:' . $item['id'], 'feed'), i18n::s('Recent files'), 'xml');
// comments are allowed
if ($cur_article->allows('creation', 'comment')) {
$lines[] = Skin::build_link($context['url_to_home'] . $context['url_to_root'] . Comments::get_url('article:' . $item['id'], 'feed'), i18n::s('Recent comments'), 'xml');
}
}
// in a side box
if (count($lines)) {
$context['components']['channels'] = Skin::build_box(i18n::s('Monitor'), join(BR, $lines), 'channels', 'feeds');
}
// twin pages
if (isset($item['nick_name']) && $item['nick_name']) {
// build a complete box
$box['text'] = '';
// list pages with same name
$items =& Articles::list_for_name($item['nick_name'], $item['id'], 'compact');
// actually render the html for the section
if (is_array($items)) {
$box['text'] .= Skin::build_list($items, 'compact');
}
if ($box['text']) {
$context['components']['twins'] = Skin::build_box(i18n::s('Related'), $box['text'], 'twins', 'twins');
}
}
// the contextual menu, in a navigation box, if this has not been disabled
if (!$cur_article->has_option('no_contextual_menu') && isset($context['current_focus']) && ($menu =& Skin::build_contextual_menu($context['current_focus']))) {
// use title from topmost level
if (count($context['current_focus']) && ($top_anchor = Anchors::get($context['current_focus'][0]))) {
$box_title = $top_anchor->get_title();
$box_url = $top_anchor->get_url();
// generic title
示例2: elseif
// look in sections
} elseif ($items =& Sections::list_for_name($id, NULL, 'full')) {
// only one section has this name
if (count($items) == 1) {
list($url, $attributes) = each($items);
Safe::redirect($url);
}
// splash
$context['text'] .= '<p>' . i18n::s('Select below among available sections.') . '</p>';
// several pages
$context['text'] .= Skin::build_list($items, 'decorated');
// look in categories
} elseif (($item = Categories::get($id)) || ($item =& Categories::get_by_keyword($id))) {
Safe::redirect(Categories::get_permalink($item));
// look in articles
} elseif ($items =& Articles::list_for_name($id, NULL, 'full')) {
// only one page has this name
if (count($items) == 1) {
list($url, $attributes) = each($items);
Safe::redirect($url);
}
// splash
$context['text'] .= '<p>' . i18n::s('Select below among available pages.') . '</p>';
// several pages
$context['text'] .= Skin::build_list($items, 'decorated');
// look in user profiles
} elseif ($item = Users::get($id)) {
Safe::redirect(Users::get_permalink($item));
// not found
} else {
$context['text'] .= '<p>' . sprintf(i18n::s('Sorry, no page has the provided name: %s'), $id) . '</p>' . "\n";