本文整理汇总了PHP中CBlog::addPost方法的典型用法代码示例。如果您正苦于以下问题:PHP CBlog::addPost方法的具体用法?PHP CBlog::addPost怎么用?PHP CBlog::addPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlog
的用法示例。
在下文中一共展示了CBlog::addPost方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CBlog
/**
* This is a Orange pagecontroller.
*
*/
// Include the essential config-file which also creates the $Orange variable with its defaults.
include __DIR__ . '/config.php';
// Do it and store it all in variables in the Orange container.
$Orange['title'] = "Edit blogpost";
$blog = new CBlog();
$filter = new CTextFilter();
if (isset($_POST['blogg'])) {
$name = $_POST['name'];
$content = $_POST['content'];
$content = $filter->doFilter(htmlentities($content, null, 'UTF-8'), 'markdown');
$published = date("Y-m-d H:i:s");
$blog->addPost($name, $content, $published);
header('Location: blog.php');
} else {
$res = $blog->getBlogContent();
$items = $blog->drawBlogs($res);
$Orange['main'] = <<<EOD
<div class="blogg">
<div class="rubrik"><p class="undertext">Bloggposter</p></div>
{$items}
</div>
<div class="blogg-form">
<div class="rubrik"><p class="undertext">Skriv ett blogg inlägg</p></div>
<form method="post" action="blog.php">
<p><label>Namn:<br/><input type='text' name='name' placeholder="Namn...."></label></p>