Created
October 3, 2010 18:57
-
-
Save joshtronic/608815 to your computer and use it in GitHub Desktop.
PICKLES Old Model versus New Model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class search extends Module | |
{ | |
public function __default() | |
{ | |
// Pulls all the active cities | |
$city = new City('list', array('fields' => 'slug, name', 'conditions' => array('active' => '1'))); | |
$cities = array_merge(array(null => 'select your city'), $city->records); | |
return array('cities' => $cities); | |
} | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class search extends Module | |
{ | |
public function __default() | |
{ | |
// Pulls all the active cities and flattens the data | |
$city = new City(array('active' => '1')); | |
$cities = array('' => 'select your city'); | |
while ($city->record) | |
{ | |
$cities[$city->record['slug']] = $city->record['name']; | |
$city->next(); | |
} | |
return array('cities' => $cities); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment