當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Post::getPosts方法代碼示例

本文整理匯總了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));
 }
開發者ID:jacobross85,項目名稱:community,代碼行數:13,代碼來源:OffenderController.php

示例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');
 }
開發者ID:jacobross85,項目名稱:community,代碼行數:11,代碼來源:BlogController.php

示例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));
 }
開發者ID:jacobross85,項目名稱:community,代碼行數:12,代碼來源:HomeController.php

示例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));
 }
開發者ID:jacobross85,項目名稱:community,代碼行數:13,代碼來源:PortalController.php

示例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));
 }
開發者ID:ardowz,項目名稱:mini-facebook,代碼行數:17,代碼來源:HomeController.php

示例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>
開發者ID:xuyintao,項目名稱:web01,代碼行數:30,代碼來源:list.php

示例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">
開發者ID:xuyintao,項目名稱:web01,代碼行數:31,代碼來源:index.php

示例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");

?>
開發者ID:numist,項目名稱:composing-stick,代碼行數:14,代碼來源:make-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');
開發者ID:hi-phper,項目名稱:xieblog,代碼行數:31,代碼來源:index.php

示例10: actionList

 /**
  *  Display a list of models
  */
 public function actionList()
 {
     $model = new Post();
     $posts = $model->getPosts();
     $this->render('list', array('posts' => $posts));
 }
開發者ID:smunchi,項目名稱:blog,代碼行數:9,代碼來源:PostController.php

示例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);
?>
開發者ID:numist,項目名稱:composing-stick,代碼行數:31,代碼來源:index.php

示例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
 */
開發者ID:volanderon,項目名稱:socialnetwork,代碼行數:31,代碼來源:index.php


注:本文中的Post::getPosts方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。