View difference between Paste ID: grh8qg2v and
SHOW:
|
|
- or go back to the newest paste.
1 | - | |
1 | + | #uri - action is translated dynamically, same with parameters |
2 | # /?pagename=user&action=findcity&term=Lond | |
3 | ||
4 | ||
5 | # Custom page template file | |
6 | <?php | |
7 | /* | |
8 | Template Name: templateName | |
9 | */ | |
10 | ||
11 | $controllerManager = getControllerManager(); | |
12 | $controllerManager->doAction('User'); #User is controller name, action translation is done | |
13 | ||
14 | # controller action example, inside UserController class | |
15 | ||
16 | public function findcityAction() | |
17 | { | |
18 | ||
19 | require_once __DIR__.'/../models/City.php'; | |
20 | ||
21 | $city = new City($this->_container); | |
22 | $cities = $city->getCities($this->getParam('term')); | |
23 | ||
24 | return $this->getHelper('Json')->send( | |
25 | $cities | |
26 | ); | |
27 | } |