Permalink
Browse files

have the home page redirect to the trends page

  • Loading branch information...
1 parent a510831 commit f5770cb70280ea99eda6fb0f768ecaf0eae2a695 @rmarianski committed Jun 1, 2011
Showing with 26 additions and 1 deletion.
  1. +1 −1 application/config/routes.php
  2. +25 −0 application/controllers/home.php
@@ -5,7 +5,7 @@
* Sets the default route to "welcome"
*/
-$config['_default'] = 'reports/submit';
+$config['_default'] = 'home';
$config['feed/atom'] = 'feed/index/atom';
// If MHI is set and we are hitting the main site, forward to the welcome, instance signup page
@@ -0,0 +1,25 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+
+// redirect to the trends page
+// need a separate controller to lookup the id of the trends page to redirect to
+// this can be different for each site based on when it was added
+// if the trends page is not found, show the map page
+
+class Home_Controller extends Main_Controller {
+
+ public function index() {
+ $pages = ORM::factory("page")
+ ->where("page_title", "Trends")
+ ->where("page_active", "1")
+ ->find_all();
+
+ if (!empty($pages)) {
+ $page = $pages[0];
+ $page_url = "page/index/" . $page->id;
+ } else {
+ $page_url = "main";
+ }
+ url::redirect($page_url);
+ }
+
+}

0 comments on commit f5770cb

Please sign in to comment.