當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Get::articleTag方法代碼示例

本文整理匯總了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)));
開發者ID:yiannisSt,項目名稱:mecha-cms,代碼行數:31,代碼來源:launch.php

示例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>';
開發者ID:yiannisSt,項目名稱:mecha-cms,代碼行數:31,代碼來源:rss.php


注:本文中的Get::articleTag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。