From 46c1d5ef254cee1288ff45ac28595d02de31636e Mon Sep 17 00:00:00 2001 From: arzynik Date: Tue, 16 Oct 2012 17:05:13 -0700 Subject: [PATCH] seo progress --- .../default/crunchbutton/home/index.php | 16 ++++- include/library/Crunchbutton/Category.php | 10 +++- include/library/Crunchbutton/Restaurant.php | 4 ++ .../default/crunchbutton/home/index.phtml | 59 ++++++++++++++++--- .../crunchbutton/layout/html.bottom.phtml | 10 +++- www/assets/js/app.js | 4 +- 6 files changed, 86 insertions(+), 17 deletions(-) diff --git a/include/controllers/default/crunchbutton/home/index.php b/include/controllers/default/crunchbutton/home/index.php index 7135cea68..e57abec2e 100644 --- a/include/controllers/default/crunchbutton/home/index.php +++ b/include/controllers/default/crunchbutton/home/index.php @@ -2,9 +2,19 @@ class Controller_home extends Cana_Controller { public function init() { - $c = Community::permalink(c::getPagePiece(0)); - if ($c->id_community) { - Cana::view()->community = $c; + if (c::getPagePiece(0)) { + $c = Community::permalink(c::getPagePiece(0)); + + if ($c->id_community) { + if (c::getPagePiece(1)) { + + $r = Restaurant::permalink(c::getPagePiece(1)); + if ($r->id_restaurant) { + Cana::view()->restaurant = $r; + } + } + Cana::view()->community = $c; + } } Cana::view()->display('home/index'); } diff --git a/include/library/Crunchbutton/Category.php b/include/library/Crunchbutton/Category.php index 8f9eee544..ae18387c3 100644 --- a/include/library/Crunchbutton/Category.php +++ b/include/library/Crunchbutton/Category.php @@ -4,7 +4,11 @@ class Crunchbutton_Category extends Cana_Table { public function restaurant() { return Restaurant::o($this->id_restaurant); } - + + public function community() { + return $this->restaurant()->community(); + } + public function dishes() { if (!isset($this->_dishes)) { $this->_dishes = Dish::q('select * from dish where id_category="'.$this->id_category.'" and dish.active=1'); @@ -19,6 +23,10 @@ class Crunchbutton_Category extends Cana_Table { } return $out; } + + public function name() { + return $this->name.($this->loc ? (' '.$this->community()->prep.' '.$this->community()->name) : ''); + } public function __construct($id = null) { parent::__construct(); diff --git a/include/library/Crunchbutton/Restaurant.php b/include/library/Crunchbutton/Restaurant.php index 777a4bc05..4f18b77e7 100644 --- a/include/library/Crunchbutton/Restaurant.php +++ b/include/library/Crunchbutton/Restaurant.php @@ -9,6 +9,10 @@ class Crunchbutton_Restaurant extends Cana_Table { ->load($id); } + public static function permalink($permalink) { + return self::q('select * from restaurant where permalink="'.$permalink.'"')->get(0); + } + public function meetDeliveryMin($order) { if (!$this->delivery_min) { return true; diff --git a/include/views/default/crunchbutton/home/index.phtml b/include/views/default/crunchbutton/home/index.phtml index a125518fb..e2718dfc3 100644 --- a/include/views/default/crunchbutton/home/index.phtml +++ b/include/views/default/crunchbutton/home/index.phtml @@ -1,8 +1,48 @@ -title = 'Food Delivery | Order Food Online from Local Restaurants for Takeout & Delivery'; -?> +restaurant->id_restaurant) : ?> + title = $this->restaurant->name.' Delivery | '.$this->restaurant->community()->name.' | Food Delivery | Order from Local Restaurants | Crunchbutton'; + ?> -community->id_community) : ?> + isBot()) : ?> +
+

Order delivery or takeout from restaurant->name?>.

+
+ + +
+ + + + +
+ +

restaurant->name?>

+
+
+
+ +
+
+

Add to your order

+ restaurant->categories() as $category) : ?> +
name()?>
+ + +
+
+ +community->id_community) : ?> + title = $this->community->name.($this->community->name_alt ? ' | '.$this->community->name_alt : '').' Food Delivery | Order Food from Local Restaurants | Crunchbutton'; + ?> isBot()) : ?>

community->name?> Online Food Delivery

@@ -11,7 +51,6 @@
- title .= ' | '.$this->community->name; ?>

Order the best food community->prep?> community->name?> with a click

We've chosen the best food from the best restaurants community->prep?> community->name?>. We save your order, delivery and payment info, so reordering is as easy as the click of a button. Click on a restaurant below to get started.

@@ -38,10 +77,14 @@
+ title = 'Food Delivery | Order Food Online from Local Restaurants for Takeout & Delivery | Crunchbutton'; + ?> + isBot()) : ?>

Online Food Ordering.

-

Order delivery & takeout online using crunchbutton or our iPhone or Android apps.

+

Order delivery & takeout using crunchbutton on your iPhone or Android.

Order your favorite Pizza with any topping online, delivered to your home. Add toppings to your pizza. Pepperoni, sausage, cheese, sauce, whatever! Don't want pizza? How about other Italian food like pasta, or a sandwich? Build your own sandwich, or order a Wenzel. @@ -66,6 +109,4 @@

- - -title .= ' | Crunchbutton'; ?> \ No newline at end of file + \ No newline at end of file diff --git a/include/views/default/crunchbutton/layout/html.bottom.phtml b/include/views/default/crunchbutton/layout/html.bottom.phtml index 899194806..1b77a3987 100644 --- a/include/views/default/crunchbutton/layout/html.bottom.phtml +++ b/include/views/default/crunchbutton/layout/html.bottom.phtml @@ -1,8 +1,12 @@ community->id_community && !c::getPagePiece(1)) { - $cc = $this->community->restaurants()->count(); - $e = $cc == 4 ? ' short-meal-list' : ''; + if ($this->community->id_community) { + if ($this->restaurant->id_restaurant) { + $e = ' smaller-width'; + } else { + $cc = $this->community->restaurants()->count(); + $e = $cc == 4 ? ' short-meal-list' : ''; + } } $basicPages = ['legal','help','faq','hello']; if (!c::getPagePiece(0) || (c::getPagePiece(0) && !in_array(c::getPagePiece(0), $basicPages) && !$this->community)) { diff --git a/www/assets/js/app.js b/www/assets/js/app.js index 899085133..89d0e669f 100644 --- a/www/assets/js/app.js +++ b/www/assets/js/app.js @@ -171,6 +171,7 @@ App.page.home = function() { }; App.page.community = function(id) { + App.lastCommunity = id; App.currentPage = 'community'; @@ -179,7 +180,7 @@ App.page.community = function(id) { App.track('Community page loaded', {community: App.community.name}); - document.title = 'Crunchbutton - ' + App.community.name; + document.title = App.community.name + (App.community.name_alt ? ' | ' + App.community.name_alt : '') + ' Food Delivery | Order Food from Local Restaurants | Crunchbutton'; var slogan = App.slogans[Math.floor(Math.random()*App.slogans.length)]; var sloganReplace = App.community.prep + ' ' + App.community.name; @@ -230,6 +231,7 @@ App.page.community = function(id) { }; App.page.restaurant = function(id) { + App.currentPage = 'restaurant'; App.cartHighlightEnabled = false;