Permalink
Browse files

fix no query results found checks

  • Loading branch information...
1 parent 612da4b commit fceeaed2cc8a0783c38c7c8d3104da37d5e410c5 @rmarianski committed Jun 1, 2011
Showing with 6 additions and 7 deletions.
  1. +3 −3 application/controllers/home.php
  2. +3 −4 application/helpers/nav.php
@@ -8,13 +8,13 @@
class Home_Controller extends Main_Controller {
public function index() {
- $pages = ORM::factory("page")
+ $page = ORM::factory("page")
->where("page_title", "Trends")
->where("page_active", "1")
->find_all();
+ $page = $page[0];
- if (!empty($pages)) {
- $page = $pages[0];
+ if ($page) {
$page_url = "page/index/" . $page->id;
} else {
$page_url = "main";
@@ -31,13 +31,12 @@ public static function main_tabs($this_page = FALSE)
// Trends page
// lookup the id from the database
- $pages = ORM::factory("page")
+ $page = ORM::factory("page")
->where("page_title", "Trends")
->where("page_active", "1")
->find_all();
- if (!empty($pages)) {
- $page = $pages[0];
-
+ $page = $page[0];
+ if ($page) {
$menu .= "<li><a href=\"".url::site()."page/index/".$page->id."\" ";
$menu .= ($this_page == 'page_'.$page->id) ? " class=\"active\"" : "";
$menu .= ">".$page->page_tab."</a></li>";

0 comments on commit fceeaed

Please sign in to comment.