本文整理汇总了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>';
}
}
示例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
}
}
示例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
}
}