Beispiel #1
0
 public function json($array)
 {
     $this->auto_render = FALSE;
     $array = json::decode_url();
     $json = array();
     $items = ORM::factory($array['class'][0])->where($array['where'])->orderby($array['orderby'])->limit($array['limit'][0])->find_all();
     foreach ($items as $item) {
         $array = $item->as_array();
         if (isset($array['url']) && !$array['url']) {
             unset($array['url']);
         }
         if (method_exists($item, 'get_url')) {
             $array['url'] = $item->get_url();
         }
         $json[] = $array;
     }
     echo json_encode($json);
     $this->auto_render = FALSE;
 }