本文整理汇总了PHP中Blog::getPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Blog::getPost方法的具体用法?PHP Blog::getPost怎么用?PHP Blog::getPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blog
的用法示例。
在下文中一共展示了Blog::getPost方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
Chunk::get('header');
?>
<div class="container-wide"><div class="container"><div class="row">
<div class="col-xs-12">
<?php
Action::run('theme_pre_content');
?>
</div>
</div><div class="row">
<div class="col-xs-12">
<div class="monstra-blog-post">
<?php
echo Blog::getPost();
?>
</div>
<small class="monstra-blog-date"><?php
echo Blog::getPostDate('d M Y');
?>
/ <?php
echo Blog::getPostAuthor();
?>
</small>
</div>
</div><div class="row">
<div class="col-xs-12">
<?php
Action::run('theme_post_content');
?>
</div>
示例2:
}
?>
<div class="jumbotron">
<h1>Hello!</h1>
<?php
if (!$user->isLoggedIn()) {
echo '<h3>Please come and stay for an while</h3>';
} else {
echo 'Welcome back ' . $user->data()->name;
}
?>
</div>
<div class="col-md-9">
<?php
$i = 0;
foreach ($blog->getPost() as $cat) {
if ($i <= 4) {
echo '<div class="panel panel-primary">';
echo '<div class="panel-heading">';
echo '<h3 class="panel-title">' . $cat->title . ' ~ ' . $cat->name . ' @ ' . $cat->date . ' By: ' . $cat->author . '</h3>';
echo '</div>';
echo '<div class="panel-body">';
echo $cat->content;
echo '</div>';
echo '</div>';
}
$i++;
}
?>
</div>
<div class="col-md-3">
示例3: foreach
if (!$val->passed()) {
?>
<div class="alert alert-danger"><?php
foreach ($val->errors() as $error) {
echo $error . '<br/>';
}
?>
</div><?php
}
}
?>
<form action="" method="post">
<div class="form-group">
<select name="post_id">
<?php
foreach ($blog->getPost() as $post) {
echo "<option name='cat' id='cat' value='{$post->post_id}'>{$post->title}</option>";
}
?>
</select>
</div>
<div class="form-group">
<label for="Confirm">Ready for deletion</label>
<input type="checkbox" id="Confirm" name="ConfirmDel" value="hello">
</div>
<div class="form-group">
<input type="hidden" name="token" value="<?php
echo Token::generate();
?>
">
<button type="submit" class="btn btn-primary">Delete</button>
示例4:
<body>
<div id="wrapper">
<header>
<a href="http://zx.rs/" class="logo">
Z
<span class="blue sub">X</span>
<span class="desc-top"><span class="blue">c</span>oder<span class="blue">'</span>s</span>
<span class="desc-bot"><span class="blue">b</span>log</span>
</a>
</header>
<section id="content">
<?php
if (!$_REQUEST['err']) {
if ($_REQUEST['id']) {
echo $blog->getPost($_REQUEST['id'], $_SESSION['username']);
} else {
echo $blog->printPosts();
}
} else {
echo $blog->displayMsg($_REQUEST['err']);
}
?>
</section>
<section id="sidebar">
<h3>latest <span class="blue">posts</span></h3>
<ul id="posts">
<?php
echo $blog->printBlogPosts();
?>
示例5: foreach
?>
<html>
<head>
<?php
include path . 'assets/php/css.php';
?>
</head>
<body>
<?php
include path . 'assets/php/nav.php';
?>
<div class="container">
<div class="col-md-9">
<?php
if (!Input::exists('get')) {
foreach ($blog->getPost() as $cat) {
echo '<div class="panel panel-primary">';
echo '<div class="panel-heading">';
echo '<h3 class="panel-title">' . $cat->title . ' ~ ' . $cat->name . ' @ ' . $cat->date . ' By: ' . $cat->author . '</h3>';
echo '</div>';
echo '<div class="panel-body">';
echo $cat->content;
echo '</div>';
echo '</div>';
}
} else {
if (Input::get('c') != null) {
$c = Input::get('c');
} else {
$c = null;
}