Last active
December 19, 2015 18:48
-
-
Save francisrod01/6001423 to your computer and use it in GitHub Desktop.
Primeiro o /Lib/LoadConfig/static.php depois o /Controller/UsersController.php
This file contains 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
App::import('Lib', 'LoadConfigs', array('file' => 'static.php')); | |
class AppController extends Controller { | |
.. |
This file contains 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 | |
/** | |
* @todo Funções estáticas | |
*/ | |
class LoadConfigs { | |
// Apos carregar a action responsavel | |
static function afterRender() { | |
$render = '/' . $this->folder_view . '/' . $this->params['controller'] . '/' . $this->params['action']; | |
return $this->render($render); | |
} | |
static function __cURL($url) { | |
// create curl resource | |
$ch = curl_init(); | |
// set url | |
curl_setopt($ch, CURLOPT_URL, $url); | |
//return the transfer as a string | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
// $output contains the output string | |
$output = curl_exec($ch); | |
// close curl resource to free up system resources | |
curl_close($ch); | |
if (!empty($output)) { | |
return $output; | |
} | |
else { | |
return NULL; | |
} | |
} | |
} | |
?> |
This file contains 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 | |
App::uses('AppController', 'Controller'); | |
/** | |
* Users Controller | |
* | |
* @property User $User | |
*/ | |
class UsersController extends AppController { | |
/** | |
* index method | |
* | |
* @return void | |
*/ | |
public function admin_index() { | |
$this->User->recursive = 0; | |
$this->set('users', $this->paginate()); | |
$this->LoadConfig->afterRender(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment