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


PHP Blog::get_blog_archives方法代码示例

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


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

示例1: show_blog_archives

/** 
* Show Blog archives list
* 
* @return void
*/
function show_blog_archives()
{
    global $blogSettings;
    $Blog = new Blog();
    $archives = $Blog->get_blog_archives();
    if (!empty($archives)) {
        echo '<ul>';
        foreach ($archives as $archive => $archive_data) {
            $post_count = $blogSettings['archivepostcount'] == 'Y' ? ' (' . $archive_data['count'] . ')' : '';
            $url = $Blog->get_blog_url('archive') . $archive;
            echo "<li><a href=\"{$url}\">{$archive_data['title']} {$post_count}</a></li>";
        }
        echo '</ul>';
    }
}
开发者ID:hatasu,项目名称:appdroid,代码行数:20,代码来源:frontEndFunctions.php

示例2: show_blog_archives

function show_blog_archives()
{
    global $blogSettings;
    // Define GLOBAL variables
    $Blog = new Blog();
    // Create a new instance of the Blog class
    $archives = $Blog->get_blog_archives();
    // Get a list of archives.
    if (!empty($archives)) {
        // If we there are any archives in the list...
        foreach ($archives as $archive => $archive_data) {
            // For each archive in the list...
            // How many posts are there in this archive?
            $post_count = $blogSettings['archivepostcount'] == 'Y' ? ' (' . $archive_data['count'] . ')' : '';
            $url = $Blog->get_blog_url('archive') . $archive;
            // What's the URL for this archive?
            echo "<li><a href=\"{$url}\">{$archive_data['title']} {$post_count}</a></li>";
            // Ouput the HTML list item
        }
    } else {
        // We have no archives in the list
        echo i18n(BLOGFILE . '/NO_ARCHIVES');
        // Let the user know
    }
}
开发者ID:Luigi-,项目名称:gs-blog,代码行数:25,代码来源:frontEndFunctions.php

示例3: bootstrap_get_blog_archives

/**
 * bootstrap_get_blog_archives()
 * 
 * This creates the HTML mark-up for the Blog Archives Widget in the
 * blog template sidebar.
 * This function supports the following plugins:
 *   - GetSimple Blog v1.4 & v3.x
 *   - GetSimple Blog v4.0+
 *   - NewsManager v2.0+
 *
 * @return (string) : Echos the HTML mark-up
 */
function bootstrap_get_blog_archives()
{
    if (function_exists('show_blog_archives')) {
        # GetSimple Blog v1.4 & v3.x
        $Blog = new Blog();
        $arch = $Blog->get_blog_archives();
        if (!empty($arch)) {
            foreach ($arch as $key => $item) {
                $url = $Blog->get_blog_url('archive') . $key;
                echo '<li class="list-group-item"><a href="' . $url . '">' . $item['title'] . '</a><span class="badge">' . $item['count'] . '</span></li>';
            }
        } else {
            echo '<li class="list-group-item">Nothing in the Archive!<span class="badge">0</span></li>';
        }
    } elseif (function_exists('gsblog_show_archives')) {
        # SimpleBlog v4.0+
        gsblog_show_archives();
    } elseif (function_exists('nm_blog_archives')) {
        # NewsManager v2.0+
        nm_blog_archives();
    } else {
        # No supported plugins found
        ?>
    <li class="list-group-item">
      <span class="badge">0</span>
      No archives to show!
    </li>
  <?php 
    }
}
开发者ID:hatasu,项目名称:appdroid,代码行数:42,代码来源:functions.php


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