public function latestAction() { $limit = (int) $this->document->getProperty('limit'); if (!$limit) { $limit = 3; } $this->view->entries = $this->_blog->getList(1, $limit)->getCurrentItems(); }
public function indexAction(array $params) { $blogModel = new Blog(); $blog = $blogModel->getList(); // get from DB $data = array('blog' => $blog); $data = array('content' => $blog); return $this->render('index', $data); }
/** * Entry list. * */ public function defaultAction() { $this->enableLayout(); $this->view->paginator = $this->_blog->getList($this->_getParam('page', 1), $this->_getParam('perpage', 10)); }
function blogHomepage() { $results = array(); $start_from = ($_GET['page'] - 1) * 5; $data = Blog::getList($start_from, HOMEPAGE_NUM_BLOG); $results['blog'] = $data['results']; $results['totalRows'] = $data['totalRows']; $results['pageTitle'] = "Widget News"; //print blog content echo "<div id='output'>"; $data = Page::getPageByTitle($_GET['action']); if ($data) { if ($data->page_protection == '1' && !isset($_SESSION['name'])) { echo "Please log-in to view this page."; } else { if ($data->page_status == 'draft') { echo "This page is not yet published. Contact the site admin."; } else { echo "<p>" . $data->page_body . "</p>"; if ($results) { $total_pages = ceil($results['totalRows'] / 5); for ($i = 1; $i <= $total_pages; $i++) { echo "<a href='#' title='" . $i . "' class='page'>" . $i . "</a> "; } foreach ($results['blog'] as $row) { $results['author'] = User::getUserById($row->author_id); $author_name = $results['author']->fname . " " . $results['author']->mname . " " . $results['author']->lname; //echo '<img src="include/images/author.png" height="90px" width="110px" class="authorimage"/>'; echo '<h1 class="blogHeader" style="color:white;"><a href="#" title="' . $row->id . '" class="viewBlog">' . $row->title . '</a></h1><p id="smallText">Published on ' . $row->publicationDate . ' by ' . $author_name . '</p><p class="blogsummary">' . $row->summary . '</p><hr color="#d6d1bf"/>'; } } } } } echo "</div>"; //end of bloog content //sidebar echo "<div id='sidebar'>"; if ($data) { echo $data->page_sidebar; } echo "</div>"; //end of sidebar }
public function executeIndex(sfWebRequest $request) { $this->page = $request->getParameter('page'); $this->count = Blog::getList('count'); $this->blog_list = Blog::getList($this->page); }