本文整理汇总了PHP中Posts::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::search方法的具体用法?PHP Posts::search怎么用?PHP Posts::search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Posts
的用法示例。
在下文中一共展示了Posts::search方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
public function search($term = '')
{
if (Input::method() == 'POST') {
if (Input::post('term') !== false) {
return Response::redirect('search/' . rawurlencode(Input::post('term')));
}
}
$search = Posts::search($term, array('status' => 'published'));
IoC::instance('search', $search, true);
$page = new StdClass();
$page->title = 'Search';
IoC::instance('page', $page, true);
Template::render('search');
}
示例2: search
public function search($term = '')
{
if (Input::method() == 'POST') {
if (Input::post('term') !== false) {
return Response::redirect('search/' . rawurlencode(Input::post('term')));
}
}
$search = Posts::search($term, array('status' => 'published', 'limit' => Config::get('metadata.posts_per_page', 10), 'offset' => Input::get('offset', 0)));
IoC::instance('search', $search, true);
$total = Posts::search_count($term, array('status' => 'published'));
IoC::instance('total_search', $total, true);
$page = new StdClass();
$page->id = -1;
$page->title = 'Search';
IoC::instance('page', $page, true);
Template::render('search');
}
示例3: Database
<h3>Read our Legend</h3>
</div>
</section>
<!-- Blogs -->
<div class="main-container">
<div class="main wrapper clearfix row">
<article class="column column-9">
<article class="single-article">
<header>
<?php
if (isset($_POST['submit'])) {
$search = $_POST['search'];
$database = new Database();
$db = $database->getConection();
$posts = new Posts($db);
$stmt = $posts->search($search);
while ($row_post = $stmt->fetch_assoc()) {
?>
<h1><a href="" title="blog" class="blog-title"><?php
echo "{$row_post['post_title']}";
?>
</a></h1>
<h2>by: <a href="" title='author' class="author"><?php
echo "{$row_post['post_author']}";
?>
</a></h2>
<div class="article-info">
<span class="date_created"><i class="fa fa-clock-o"></i> <?php
echo "{$row_post['post_date']}";
?>
</span>