当前位置: 首页>>代码示例>>PHP>>正文


PHP Get::tag方法代码示例

本文整理汇总了PHP中Get::tag方法的典型用法代码示例。如果您正苦于以下问题:PHP Get::tag方法的具体用法?PHP Get::tag怎么用?PHP Get::tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Get的用法示例。


在下文中一共展示了Get::tag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: function

 *  RETURN SPECIFIC PAGE/ARTICLE TAG ITEM FILTERED BY ITS AVAILABLE DATA
 * ==========================================================================
 *
 * -- CODE: -----------------------------------------------------------------
 *
 *    $tag = Get::pageTag('lorem-ipsum');
 *    $tag = Get::articleTag('lorem-ipsum');
 *
 * --------------------------------------------------------------------------
 *
 */
Get::plug('pageTag', function ($filter, $output = null, $fallback = false) {
    return Get::tag($filter, $output = null, $fallback = false, 'page');
});
Get::plug('articleTag', function ($filter, $output = null, $fallback = false) {
    return Get::tag($filter, $output = null, $fallback = false, 'article');
});
/**
 * ==========================================================================
 *  GET PAGE/ARTICLE PATH
 * ==========================================================================
 *
 * -- CODE: -----------------------------------------------------------------
 *
 *    var_dump(Get::pagePath('lorem-ipsum'));
 *    var_dump(Get::articlePath('lorem-ipsum'));
 *
 * --------------------------------------------------------------------------
 *
 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *  Parameter | Type  | Description
开发者ID:yiannisSt,项目名称:mecha-cms,代码行数:31,代码来源:get.php

示例2: sprintf

        Shield::abort('404-archive');
    }
    $time = $config->widget_year_first ? $year . ', ' . $months[(int) $month - 1] : $months[(int) $month - 1] . ' ' . $year;
    Config::set(array('page_title' => (strpos($config->archive->title, '%s') !== false ? sprintf($config->archive->title, $time) : $config->archive->title . ' ' . $time) . $config->title_separator . $config->title, 'offset' => $offset, 'archive_query' => $slug, 'articles' => $articles, 'pagination' => Navigator::extract(Get::articles('DESC', 'time:' . $slug), $offset, $config->archive->per_page, $config->archive->slug . '/' . $slug)));
    Shield::attach('index-archive');
}, 41);
/**
 * Tag Page
 * --------
 *
 * [1]. tagged/tag-slug
 * [2]. tagged/tag-slug/1
 *
 */
Route::accept(array($config->tag->slug . '/(:any)', $config->tag->slug . '/(:any)/(:num)'), function ($slug = "", $offset = 1) use($config) {
    if (!($tag = Get::tag($slug))) {
        Shield::abort('404-tag');
    }
    $articles = array();
    $offset = (int) $offset;
    if ($files = Mecha::eat(Get::articles('DESC', 'kind:' . $tag->id))->chunk($offset, $config->tag->per_page)->vomit()) {
        foreach ($files as $file) {
            $articles[] = Get::article($file, array('content', 'tags', 'css', 'js', 'comments'));
        }
        unset($files);
    } else {
        Shield::abort('404-tag');
    }
    Config::set(array('page_title' => (strpos($config->tag->title, '%s') !== false ? sprintf($config->tag->title, $tag->name) : $config->tag->title . ' ' . $tag->name) . $config->title_separator . $config->title, 'offset' => $offset, 'tag_query' => $slug, 'articles' => $articles, 'pagination' => Navigator::extract(Get::articles('DESC', 'kind:' . $tag->id), $offset, $config->tag->per_page, $config->tag->slug . '/' . $slug)));
    Shield::attach('index-tag');
}, 50);
开发者ID:razordaze,项目名称:mecha-cms,代码行数:31,代码来源:launch.php


注:本文中的Get::tag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。