本文整理汇总了PHP中Blog::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Blog::all方法的具体用法?PHP Blog::all怎么用?PHP Blog::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blog
的用法示例。
在下文中一共展示了Blog::all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
require 'inc.config.php';
user::check('logged in');
require 'inc.account.php';
$blogs = Blog::all($account);
$subscriptions = $db->select_fields('subscriptions', 'blog_id', array('user_id' => $account->id));
// SAVE
if (isset($_POST['feeds'])) {
// delete old subscriptions
$db->delete('subscriptions', array('user_id' => $account->id));
// add new subscriptions
$db->begin();
foreach ($_POST['feeds'] as $blogId) {
if (isset($blogs[$blogId])) {
$db->insert('subscriptions', array('user_id' => $account->id, 'blog_id' => $blogId));
}
}
$db->commit();
user::success('Subscriptions saved!');
redirect();
} else {
if (isset($_GET['export'])) {
header('Content-type: text/plain');
header('Content-Disposition: attachment; filename="blogs.txt"');
$blogs = $db->fetch('SELECT b.* FROM blogs b JOIN subscriptions s ON (b.id = s.blog_id AND s.user_id = ?)', array($account->id));
foreach ($blogs as $blog) {
echo $blog->feed . "\n";
}
exit;
}
示例2: custom
public function custom()
{
$this->load->model("blog/blog");
return Blog::all();
}
示例3: Blog
<?php
$b = new Blog();
$u = new User();
$all = true;
$self = false;
if (isset($_GET['follow']) && $_GET['follow'] == true) {
$blogs = $b->blogFromFollower($_COOKIE['username']);
$all = false;
} else {
$blogs = $b->all();
}
$follows = $u->follower($_COOKIE['username']);
?>
<div class="row">
<div class="col-md-8">
<h1 class="page-header">
Twitts
<!-- <a href="http://localhost/Zipdrug/blog/follower"><small>Only Followers</small></a> -->
</h1>
<?php
if ($all == false) {
?>
<a href="http://localhost/Zipdrug/user/home"><span> Back to all</span></a>
<?php
} else {
?>
<a href="http://localhost/Zipdrug/user/home?follow=true"><span> Click to Show only from follower</span></a>
<?php
}
foreach ($blogs as $blog) {