Пример #1
0
 /**
  * Lists all artists based on a search per country
  *
  * @return String
  */
 public function getListing()
 {
     // If it's an ajax search
     $json_content = file_get_contents('php://input');
     if ($json_content) {
         // Gets JSON request to read country name typed
         $data = json_decode($json_content);
         $country = $data->country;
         $page = $data->page;
         $response = array();
         // Performs search
         $artist = new Artist();
         $artists = $artist->search($country, $page);
         // Returns JSON for AngularJS
         print json_encode($artists);
         exit;
     }
     // If it's a GET request, just displays the HTML
     $template = 'views/artist/listing.html';
     print file_get_contents($template);
 }