Skip to content

Commit

Permalink
fix no query results found checks
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarianski committed Jun 1, 2011
1 parent 612da4b commit fceeaed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions application/controllers/home.php
Expand Up @@ -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";
Expand Down
7 changes: 3 additions & 4 deletions application/helpers/nav.php
Expand Up @@ -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>";
Expand Down

0 comments on commit fceeaed

Please sign in to comment.