function index() { $this->output->cache(30); $this->config->set_item('class_as_root', false, 'ifx'); data('scrollHeader', true); $LatestPosts = new mBlogPost(); data('Posts', $LatestPosts->list_all(TRUE, 3)->get()); $this->display('homepage'); }
function post($PostID, $RevisionID = null, $Slug = NULL) { $this->output->cache(30); $Post = new mBlogPost($PostID); if (empty($RevisionID)) { $Published = $Post->published; } else { $Published = new mBlogPostRevision($RevisionID); } if (!$Post->is_loaded() || !$Published->is_loaded()) { redirect('/blog/notfound'); } data('Post', $Post); data('Published', $Published); data('MetaDescription', $Published->metadesc); $this->display('post'); }
function delete($BlogID) { $Blog = new mBlogPost($BlogID); $Blog->delete(); redirect($_SERVER['HTTP_REFERER']); }
<div class="recent-posts"> <h3>Recent Posts</h3> <?php $Other = new mBlogPost(); $All = $Other->list_all()->get(); ?> <ul> <?php foreach ($All as $OtherPost) { ?> <?php if (isset($Post) && $OtherPost->id() == $Post->id()) { continue; } ?> <li> <span class="post-date"><?php echo date('d.m.y', $Published->updated); ?> </span> <a href="<?php echo posturl($OtherPost); ?> "><img src="<?php echo $OtherPost->mainimage; ?> "/><?php echo $OtherPost->title; ?> </a> </li>