本文整理汇总了PHP中Blog::getPosts方法的典型用法代码示例。如果您正苦于以下问题:PHP Blog::getPosts方法的具体用法?PHP Blog::getPosts怎么用?PHP Blog::getPosts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blog
的用法示例。
在下文中一共展示了Blog::getPosts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_posts
/**
*
* @param int $limit [description]
* @return array
*/
public static function get_posts($limit = false)
{
$blog = new Blog('posts/');
// Get drafted posts as well
if (User::is_logged_in()) {
return $blog->getAllPosts($limit);
}
return $blog->getPosts($limit);
}
示例2:
<div class="container-wide">
<div class="container">
<div class="row">
<div class="col-xs-12">
<?php
Action::run('theme_pre_content');
?>
</div>
</div>
<div class="row">
<div class="col-xs-8">
<?php
echo Blog::getPosts(3);
?>
</div>
<div class="col-xs-4 tags">
<h3>Tags</h3>
<?php
echo Blog::getTags();
?>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<?php
Action::run('theme_post_content');
?>
示例3: Blog
<!DOCTYPE html>
<html lang="en">
<?php
include 'src/Config.php';
include 'src/Post.php';
include 'src/Bio.php';
include 'src/Blog.php';
include 'src/Header.php';
$blog = new Blog();
$bio = $blog->getBio();
$header = $blog->getHeader();
if (empty($_GET["tag"])) {
$posts = $blog->getPosts();
} else {
$p = new Post();
$posts = $p->getPostsByTag($_GET["tag"]);
}
//var_dump($p);
$actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
?>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title><?php