本文整理匯總了PHP中Posts::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Posts::getId方法的具體用法?PHP Posts::getId怎麽用?PHP Posts::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Posts
的用法示例。
在下文中一共展示了Posts::getId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: executeCreate
public function executeCreate()
{
$taxonomy = $this->request()->get('taxonomy', 'STRING', 'post');
$this->setView('Post/form');
$post = new \Posts();
$post->setIsDraft(true);
$post->setTaxonomy($taxonomy);
$post->save(false);
//save Draft before
$this->redirect($this->createUrl('post/edit', array('id' => $post->getId(), 'taxonomy' => $taxonomy)));
/*$error = array();
if ($this->request()->isPostRequest()) {
if ($this->_save($post, $error)) {
Session::getInstance()->setFlash('post_message', t($post->getTitle() .' was saved!'));
$this->redirect($this->createUrl('post/default', array('taxonomy' => $taxonomy)));
}
}
$this->view()->assign(array(
'post' => $post,
'taxonomy' => $taxonomy,
'error' => $error,
'page_title' => t('New post')
));
return $this->renderComponent();
*/
}
示例2: Posts
<div class="page-title">
<h2>Blog</h2>
<h1>STAY IN TOUCH</h1>
<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($_GET['id'])) {
$posts = new Posts($db);
$stmt = $posts->getId($_GET['id']);
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>