本文整理汇总了PHP中Get::articleTag方法的典型用法代码示例。如果您正苦于以下问题:PHP Get::articleTag方法的具体用法?PHP Get::articleTag怎么用?PHP Get::articleTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Get
的用法示例。
在下文中一共展示了Get::articleTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
Filter::add('pager:url', function ($url) {
return Filter::apply('archive:url', $url);
});
Config::set(array('page_title' => sprintf($config->archive->title, $year . ', ' . $months[(int) $month - 1]) . $config->title_separator . $config->title, 'archive_query' => $slug, 'offset' => $offset, 'articles' => $articles, 'pagination' => Navigator::extract($s, $offset, $config->archive->per_page, $config->archive->slug . '/' . $slug)));
Shield::attach('index-archive');
}, 41);
/**
* Tag Page
* --------
*
* [1]. tag/tag-slug
* [2]. tag/tag-slug/1
*
*/
Route::accept(array($config->tag->slug . '/(:any)', $config->tag->slug . '/(:any)/(:num)'), function ($slug = "", $offset = 1) use($config, $excludes) {
if (!($tag = Get::articleTag('slug:' . $slug))) {
Shield::abort('404-tag');
}
$offset = (int) $offset;
$s = Get::articles('DESC', 'kind:' . $tag->id);
if ($articles = Mecha::eat($s)->chunk($offset, $config->tag->per_page)->vomit()) {
$articles = Mecha::walk($articles, function ($path) use($excludes) {
return Get::article($path, $excludes);
});
} else {
Shield::abort('404-tag');
}
Filter::add('pager:url', function ($url) {
return Filter::apply('tag:url', $url);
});
Config::set(array('page_title' => sprintf($config->tag->title, $tag->name) . $config->title_separator . $config->title, 'tag_query' => $slug, 'offset' => $offset, 'articles' => $articles, 'pagination' => Navigator::extract($s, $offset, $config->tag->per_page, $config->tag->slug . '/' . $slug)));
示例2: ceil
echo '<link>' . $config->url . '/</link>';
echo '<description>' . $config->description . '</description>';
echo '<lastBuildDate>' . Date::format(time(), 'r') . '</lastBuildDate>';
echo '<atom:link rel="self" href="' . $config->url_current . '"/>';
echo $config->offset > 1 ? '<atom:link rel="previous" href="' . Filter::colon('feed:url', $url_base . '/' . ($config->offset - 1)) . '"/>' : "";
echo $config->offset < ceil($config->total_articles / $rss_limit) ? '<atom:link rel="next" href="' . Filter::colon('feed:url', $url_base . '/' . ($config->offset + 1)) . '"/>' : "";
Weapon::fire('rss_meta');
if (!empty($bucket)) {
foreach ($bucket as $i => $item) {
$title = strip_tags($item->title);
$description = $item->description;
$kind = Mecha::A($item->kind);
echo '<item>';
echo '<title><![CDATA[' . $title . ']]></title>';
echo '<link>' . $item->url . '</link>';
echo '<description><![CDATA[' . $description . ']]></description>';
echo '<pubDate>' . Date::format($item->time, 'r') . '</pubDate>';
echo '<guid>' . $item->url . '</guid>';
if (!empty($kind)) {
foreach ($kind as $k) {
$tag = Get::articleTag($k);
echo '<category domain="' . Filter::colon('tag:url', $config->url . '/' . $config->tag->slug . '/' . $tag->slug) . '">' . $tag->name . '</category>';
}
}
echo '<source url="' . $item->url . '"><![CDATA[' . $config->title . ': ' . $title . ']]></source>';
Weapon::fire('rss_item', array($item, $i));
echo '</item>';
}
}
echo '</channel>';
echo '</rss>';