Last active
August 29, 2015 14:11
-
-
Save jonasporto/33c6b744e4f04a8b4bfa to your computer and use it in GitHub Desktop.
url query php
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
| function url_query(){ | |
| $this->autoRender = false; | |
| extract($this->params['named']); | |
| $model = ClassRegistry::init($model); | |
| if($conditions) $options['conditions'] = $conditions; | |
| if($contain) $options['contain'] = explode(' ',$contain); | |
| if($limit) $options['limit'] = $limit; | |
| $result = $model->find($find,$options); | |
| if($resource == 'json'){ | |
| header('Content-Type: application/json'); | |
| return json_encode($result); | |
| } | |
| return $result; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment