本文整理汇总了PHP中Post::getPosts方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::getPosts方法的具体用法?PHP Post::getPosts怎么用?PHP Post::getPosts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Post
的用法示例。
在下文中一共展示了Post::getPosts方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndex
/**
* Setup the layout used by the controller.
*
* @return void
*/
public function getIndex()
{
$posts = Post::getPosts();
for ($x = 0; $x < count($posts); $x++) {
$posts[$x]['post_tags'] = implode(', ', $this->linkTagByPostId($posts[$x]['post_id']));
}
return View::make('blog', array('posts' => $posts));
}
示例2: getPost
public function getPost($user, $year, $month, $day, $term = NULL)
{
$guid = "{$user}/{$year}/{$month}/{$day}/";
$post = Post::getPosts(array('guid' => $guid, 'limit' => 1));
$post = array_pop($post);
$post->post_tags = implode(', ', $this->linkTagByPostId($post->post_id));
if (is_object($post)) {
return View::make('blog.post', array('post' => $post));
}
return View::make('blog.404');
}
示例3: getIndex
public function getIndex()
{
$posts = Post::getPosts(array('limit' => 1));
if (is_array($posts)) {
for ($x = 0; $x < count($posts); $x++) {
$posts[$x]->post_tags = implode(', ', $this->linkTagByPostId($posts[$x]->post_id));
}
}
$tagCloud = Post::getTagCloud();
$offenders = Offender::getOffenders();
return View::make('home', array('posts' => $posts, 'tagCloud' => $tagCloud, 'offenders' => $offenders));
}
示例4: getIndex
public function getIndex()
{
$this_user = Session::get('user');
$posts = Post::getPosts();
if (!is_array($posts)) {
$posts = array();
}
for ($x = 0; $x < count($posts); $x++) {
$tags = Post::getTagsByPostId($posts[$x]->post_id);
$posts[$x]->post_tags = is_array($tags) ? implode(', ', array_pluck($tags, 'tag_name')) : '';
}
return View::make('portal', array('error' => Session::get('error'), 'success' => Session::get('success'), 'validation' => Session::get('validation'), 'posts' => $posts));
}
示例5: home
public function home($friend_user_id = false)
{
$firstName = Auth::user()->first_name;
$postModel = new Post();
if ($friend_user_id) {
$userID = $friend_user_id;
$friend = User::find($userID);
$friendName = $friend->first_name . ' ' . $friend->last_name;
$firstName = "to {$friendName}'s Page";
} else {
$userID = Auth::user()->id;
}
// $allMyPosts = $postModel->getAllMyPosts($userID);
$allMyPosts = $postModel->getPosts($userID);
$myFriends = $this->getFriends($userID);
return View::make('home.home', array('firstName' => $firstName, 'posts' => $allMyPosts, 'friends' => $myFriends));
}
示例6: intval
$cateName1 = $cate->getCateNameById($cateId1);
$cateName2 = $cate->getCateNameById($cateId2);
$pageIndex = intval($_GET["p"]);
if (empty($pageIndex)) {
$pageIndex = 1;
}
$pageSize = 12;
$post = new Post(2114);
$search = new PostSearch();
$search->CategoryId = $cateId1;
$search->CategoryRoot = 1001;
$search->Orderby = "orderasc";
$search->PageIndex = $pageIndex;
$search->PageSize = $pageSize;
$search->Status = 1;
$posts = $post->getPosts($search);
$target = "list.php?cateId1=" . $cateId1 . "&cateId2=" . $cateId2 . "&p=";
$totalCount = $post->getPostsCount($search);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>钛铂新媒体-信息列表</title>
<meta name="keywords" content="钛铂新媒体,新媒体营销 ,微博营销,尚道微营销,EPR(互联网公关),新媒体Campaign战役营销,微博微信定制化解决,微博微信运营,大数据,新媒体投放">
<meta name="description" content="钛铂新媒体,新媒体营销 ,微博营销,尚道微营销,EPR(互联网公关),新媒体Campaign战役营销,微博微信定制化解决,微博微信运营,大数据,新媒体投放">
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="shortcut icon" href=" images/favicon.ico" />
<link type="text/css" rel="stylesheet" href="css/website.css">
</head>
示例7: Post
<?php
error_reporting(E_ALL);
require __DIR__ . '/autoload.php';
$post = new Post(2114);
$search = new PostSearch();
$search->CategoryId = 4225;
$search->CategoryRoot = 1001;
$search->Orderby = "orderasc";
$search->PageIndex = 1;
$search->PageSize = 4;
$search->Status = 1;
$news = $post->getPosts($search);
$search->CategoryId = 4226;
$view = $post->getPosts($search);
$search->CategoryId = 4226;
$view = $post->getPosts($search);
$search->PageSize = 6;
$search->CategoryId = 4237;
$case = $post->getPosts($search);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>钛铂新媒体</title>
<meta name="keywords" content="钛铂新媒体,新媒体营销 ,微博营销,尚道微营销,EPR(互联网公关),新媒体Campaign战役营销,微博微信定制化解决,微博微信运营,大数据,新媒体投放">
<meta name="description" content="钛铂新媒体,新媒体营销 ,微博营销,尚道微营销,EPR(互联网公关),新媒体Campaign战役营销,微博微信定制化解决,微博微信运营,大数据,新媒体投放">
<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="shortcut icon" href=" images/favicon.ico" />
<link type="text/css" rel="stylesheet" href="css/website.css">
示例8: define
<?
define("BLOGROOT", dirname($argv[0])."/../");
define("WEBROOT", "http://numist.net/");
require_once(BLOGROOT."lib/intro.inc");
require_once(BLOGROOT."lib/post.class.inc");
assert('$argc == 1');
$posts = Post::getPosts();
require(BLOGROOT."lib/atom.php");
?>
示例9: Config
use JasonGrimes\Paginator;
$config = new Config('config.json');
Flight::set('flight.views.path', './templates/' . $config->get('template'));
Flight::route('/', function () use($config) {
$post = new Post();
$page = 1;
$posts = $post->getPosts($page, $config->get('per_page'));
$totalItems = count($post->getPostNames());
$urlPattern = $config->get('base_url') . 'page/(:num)';
$paginator = new Paginator($totalItems, $config->get('per_page'), $page, $urlPattern);
Flight::render('index', array('posts' => $posts, 'config' => $config, 'paginator' => $paginator), 'content_layout');
Flight::render('layouts/default');
});
Flight::route('/page/@page', function ($page) use($config) {
$post = new Post();
$posts = $post->getPosts($page, $config->get('per_page'));
$totalItems = count($post->getPostNames());
$urlPattern = $config->get('base_url') . 'page/(:num)';
$paginator = new Paginator($totalItems, $config->get('per_page'), $page, $urlPattern);
Flight::render('index', ['posts' => $posts, 'config' => $config, 'paginator' => $paginator], 'content_layout');
Flight::render('layouts/default');
});
Flight::route('/posts/@name', function ($name) use($config) {
$name = str_replace('../', '', $name);
$name = 'posts/' . $name . '.md';
if (file_exists($name)) {
$onePost = new Post();
$onePost->setListView(FALSE);
$post = $onePost->getPost($name);
Flight::render('post', ['post' => $post, 'config' => $config], 'content_layout');
Flight::render('layouts/default');
示例10: actionList
/**
* Display a list of models
*/
public function actionList()
{
$model = new Post();
$posts = $model->getPosts();
$this->render('list', array('posts' => $posts));
}
示例11: foreach
$pages = $matches[2];
}
} else {
$start = $matches[2];
$pages = $matches[3] - $matches[2] + 1;
}
}
$posts = Post::getPages($start, $pages);
foreach($posts as $post) {
echo poast($post);
}
if(count($posts) && count(Post::getPosts(null, 10, $posts[count($posts) - 1]->timestamp(true)))) {
?><article id="more"><p><a href="<?php
echo $webroot;
?>
?/page/<?php
echo $start + $pages;
?>
/">more…</a></p></article><?
}
require(BLOGROOT."templates/footer.inc");
?>
<!-- <?php
echo number_format(microtime(true) - $page_start, 4);
?>
示例12: function
*/
$app->post('/uploadPhoto', function () use($user, $app, $login) {
echo json_encode($user->uploadPhoto($_SESSION['auth']['user_id'], $_FILES['photo'], $login));
});
$app->post('/uploadCover', function () use($user, $app, $login) {
echo json_encode($user->uploadCover($_SESSION['auth']['user_id'], $_FILES['cover'], $login));
});
$app->put('/changePassword', function () use($user, $app) {
$passwords = json_decode($app->request->getBody(), true);
echo json_encode($user->changePassword($_SESSION['auth']['user_id'], $passwords));
});
/**
* Posts
*/
$app->get('/posts/:type/:user_id/:offset/:limit', function ($type, $user_id, $offset, $limit) use($post, $app) {
echo json_encode($post->getPosts($type, $user_id, null, $offset, $limit));
});
$app->get('/post/:id', function ($id) use($post) {
echo json_encode($post->getPostById($id));
});
$app->post('/post', function () use($post, $app) {
$data = json_decode($app->request->getBody());
echo json_encode($post->publishPost($_SESSION['auth']['user_id'], $data->friend_id, $data->content));
});
$app->delete('/post', function () use($post, $app) {
$post_id = json_decode($app->request->getBody());
echo json_encode($post->deletePost($_SESSION['auth']['user_id'], $post_id));
});
/**
* Posts - Like
*/