当前位置: 首页>>代码示例>>PHP>>正文


PHP Blog::findAll方法代码示例

本文整理汇总了PHP中Blog::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Blog::findAll方法的具体用法?PHP Blog::findAll怎么用?PHP Blog::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Blog的用法示例。


在下文中一共展示了Blog::findAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * Index action
  * Show all blog posts
  */
 public function index()
 {
     $blog = new Blog();
     $params = array('blogs' => $blog->findAll());
     $this->setParams('params', $params);
     $this->render();
 }
开发者ID:gitter-badger,项目名称:Mist-1,代码行数:11,代码来源:BlogController.php

示例2: index

 public function index()
 {
     // Blogクラスから$Blogインスタンス生成
     $Blog = new Blog($this->plural_resource);
     $sql = $Blog->findAll();
     // 'SELECT * FROM blogs'という文字列が返ってくる
     $blogs = mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
     return $blogs;
 }
开发者ID:KoichiTakashiro,项目名称:geechscamp,代码行数:9,代码来源:blogs_controller.php

示例3: index

 public function index($category_id)
 {
     //var_dump($_GET['search']);
     // Blogクラスから$Blogインスタンス生成
     $Blog = new Blog($this->plural_resource);
     if (isset($_GET['search'])) {
         $sql = $Blog->findAll($category_id, $_GET['search']);
     } else {
         $sql = $Blog->findAll($category_id);
         // 'SELECT * FROM blogs'という文字列が返ってくる
     }
     //var_dump($sql);
     $blogs = mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
     //var_dump($blogs);
     //var_dump('test');
     $Category = new Category('categories');
     $cat_sql = $Category->findAll();
     //var_dump($cat_sql);
     $categories = mysqli_query($this->db, $cat_sql) or die(mysqli_error($this->db));
     //var_dump($categories);
     $return['blogs'] = $blogs;
     $return['categories'] = $categories;
     return $return;
 }
开发者ID:ei17ringo,项目名称:simpleframework,代码行数:24,代码来源:blogs_controller.php

示例4: actionView

 public function actionView($id)
 {
     $id = intval($id);
     $blog = Blog::model()->find('id=:id', array('id' => $id));
     $blog->views += 1;
     $blog->save();
     $catelist = Category::getDropList(1);
     $model = new Blog();
     $criteria = new CDbCriteria();
     //查询条件
     $criteria->addCondition("is_show=1");
     //排序
     $criteria->order = 'id DESC';
     $criteria->limit = 5;
     $recent = $model->findAll($criteria);
     $this->render('view2', array('blog' => $blog, 'catelist' => $catelist, 'recent' => $recent));
 }
开发者ID:s-nice,项目名称:24int,代码行数:17,代码来源:BlogController.php

示例5: getGlobal

<?php

$root = $GLOBALS['root'];
$footLines = getGlobal('footLines');
$posts = Blog::findAll("ORDER BY datetime DESC LIMIT 5");
?>
	</section>
</div>

<footer>
	<div class='container'>
		<div class='row'>
			<div class='col-sm-4 col-xs-12'>
				<h2>Recent Articles</h2>
				<ul>
					<?php 
if (count($posts)) {
    foreach ($posts as $post) {
        $title = $post->title;
        $year = getDateElements("%Y", $post->datetime);
        $link = $root . DS . 'blog' . DS . $year . DS . snakeString($title);
        ?>
							<li><a href='<?php 
        echo $link . DS;
        ?>
'><?php 
        echo $title;
        ?>
</a></li>
						<?php 
    }
开发者ID:RezNikTaylor,项目名称:RNK-Redesign,代码行数:31,代码来源:footer.php

示例6: get

 /**
  * Get a list of blogs
  *
  * @param Request $request
  * @param string $params
  * @return void
  */
 protected static function get($request, $params)
 {
     $blogs = Blog::findAll($request->include);
     static::response($blogs, 200);
 }
开发者ID:anehx,项目名称:blog,代码行数:12,代码来源:BlogListController.class.php

示例7: foreach

<?php

$root = './../../..';
require $root . '/../app/initialize.php';
$pageTitle = 'Manage Blog';
$navSelect = 'blog';
$user = User::get('admin');
$posts = Blog::findAll("ORDER BY title ASC");
?>

<?php 
includeFile('site/header.php');
?>

	<h2>Blog</h2>
	<h3>Articles</h3>

<?php 
getAlerts();
?>

	<p><a href='post.php'>Write New Post</a></p>

<?php 
if (count($posts)) {
    ?>
	<table class="table table-hover">
		<tbody>
		<?php 
    foreach ($posts as $post) {
        ?>
开发者ID:RezNikTaylor,项目名称:RNK-Redesign,代码行数:31,代码来源:index.php


注:本文中的Blog::findAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。