seo progress

This commit is contained in:
arzynik 2012-10-16 17:05:13 -07:00
parent c152654699
commit 46c1d5ef25
6 changed files with 86 additions and 17 deletions

View File

@ -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');
}

View File

@ -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();

View File

@ -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;

View File

@ -1,8 +1,48 @@
<?
$this->title = 'Food Delivery | Order Food Online from Local Restaurants for Takeout &amp; Delivery';
?>
<? if ($this->restaurant->id_restaurant) : ?>
<?
$this->title = $this->restaurant->name.' Delivery | '.$this->restaurant->community()->name.' | Food Delivery | Order from Local Restaurants | Crunchbutton';
?>
<? if ($this->community->id_community) : ?>
<? if (c::app()->isBot()) : ?>
<div class="home-text">
<h2>Order <b>delivery</b> or <b>takeout</b> from <?=$this->restaurant->name?>.</h2>
</div>
<? endif ; ?>
<div itemscope itemtype="http://schema.org/Restaurant">
<link itemprop="name" href="<?=$this->restaurant->name?>"/>
<link itemprop="description" href="Order food delivery or takeout from <?=$this->restaurant->name?> in <?=$this->community->name?> on Crunchbutton"/>
<link itemprop="url" href="/<?=$this->community->permalink?>/<?=$this->restaurant->permalink?>"/>
<link itemprop="image" href="<?=$this->restaurant->image() ? '/cache/images/'.$this->restaurant->image()->getFileName() : ''?>"/>
</div>
<div class="restaurant-name"><h1><?=$this->restaurant->name?></h1></div>
<div class="restaurant-pic-wrapper">
<div class="restaurant-pic" style="background: url(<?=$this->restaurant->image() ? '/cache/images/'.$this->restaurant->image()->getFileName() : ''?>);"></div>
</div>
<div class="main-content-readable">
<div class="restaurant-items">
<div class="content-item-name content-item-main-name"><h1>Add to your order</h1></div>
<? foreach ($this->restaurant->categories() as $category) : ?>
<div class="restaurant-item-title"><?=$category->name()?></div>
<ul class="resturant-dishes resturant-dish-container" date-id_category="1">
<? foreach ($category->dishes() as $dish) : ?>
<li>
<a href="javascript:;" data-id_dish="1">
<span class="dish-name"><?=$dish->name?></span><span class="dish-price">($<?=number_format($dish->price,2)?>)</span>
</a>
</li>
<? endforeach ; ?>
</ul>
<? endforeach ; ?>
</div>
</div>
<? elseif ($this->community->id_community) : ?>
<?
$this->title = $this->community->name.($this->community->name_alt ? ' | '.$this->community->name_alt : '').' Food Delivery | Order Food from Local Restaurants | Crunchbutton';
?>
<? if (c::app()->isBot()) : ?>
<div class="home-text">
<h1><?=$this->community->name?> Online Food Delivery</h1>
@ -11,7 +51,6 @@
</div>
<? endif ; ?>
<? $this->title .= ' | '.$this->community->name; ?>
<div class="home-tagline">
<h1>Order the best food <?=$this->community->prep?> <?=$this->community->name?> with a click</h1>
<h2>We've chosen the best food from the best restaurants <?=$this->community->prep?> <?=$this->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.</h2>
@ -38,10 +77,14 @@
</div>
<? else : ?>
<?
$this->title = 'Food Delivery | Order Food Online from Local Restaurants for Takeout &amp; Delivery | Crunchbutton';
?>
<? if (c::app()->isBot()) : ?>
<div class="home-text">
<h1>Online Food Ordering. </h1>
<h2>Order <b>delivery</b> &amp; <b>takeout</b> online using crunchbutton or our <b>iPhone</b> or <b>Android</b> apps.</h2>
<h2>Order <b>delivery</b> &amp; <b>takeout</b> using crunchbutton on your iPhone or Android.</h2>
<p>
Order your favorite <b>Pizza</b> 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 <b>Italian food</b> like pasta, or a sandwich? Build your own sandwich, or order a <b>Wenzel</b>.
@ -66,6 +109,4 @@
</div>
</div>
<? endif ; ?>
<? $this->title .= ' | Crunchbutton'; ?>
<? endif ; ?>

View File

@ -1,8 +1,12 @@
</head>
<?
if ($this->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)) {

View File

@ -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;