本文整理匯總了PHP中CBlog::postsExists方法的典型用法代碼示例。如果您正苦於以下問題:PHP CBlog::postsExists方法的具體用法?PHP CBlog::postsExists怎麽用?PHP CBlog::postsExists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CBlog
的用法示例。
在下文中一共展示了CBlog::postsExists方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isset
/**
* This is a Hera pagecontroller.
*
*/
// Include the essential config-file which also creates the $anax variable with its defaults.
include __DIR__ . '/config.php';
// add style for database tabels
$hera['stylesheets'][] = 'css/blog.css';
$hera['stylesheets'][] = 'css/breadcrumb.css';
$slug = isset($_GET['slug']) ? $_GET['slug'] : null;
$cat = isset($_GET['cat']) ? $_GET['cat'] : null;
// Database
$db = new CDatabase($hera['database']);
// Blog handler
$blog = new CBlog($db);
$blog->getPostsFromSlug($slug, $cat);
// Do it and store it all in variables in the Hera container.
$hera['title'] = "Nyheter";
$hera['main'] = null;
if ($blog->postsExists()) {
$hera['main'] = $blog->printPosts();
} else {
if ($slug) {
$hera['main'] = "<h1>{$hera['title']}</h1><p>Det fanns inte en sådan bloggpost.</p><p><a href='blog.php'>Visa alla</a></p>";
} else {
$hera['main'] = "<h1>{$hera['title']}</h1>Det fanns inga bloggposter.</p>";
}
}
//Finally, leave it all to the rendering phase of Hera.
include HERA_THEME_PATH;