Added Canvas 1.1.0, originally not under SCM so no historical development records...
[canvas.git] / scripts / generator / templates / controller.rhtml
blobdf82f6048fa220b7019ebf8670c5637cbaa97a33
1 <?php
2         /*
3                 @title      <%= @title %>
4                 @created_by <%= @author %>
5                 @created_at <%= Time.now %>
6                 @desc       <%= @desc %>
7         */
8         
9         class <%= @controller_name %>_controller extends application_controller {
10                 <% for action in @actions %>
11                 public function <%= action %>() {
12                         // controller logic for <%= action %> action here
13                 }
14                 <% end %>
15                 
16                 /*
17                         #### Example Code ####
18                         
19                         // respond (send to View)
20                         $this->response->name = $value;
21                         
22                         // redirect to another action
23                         $this->redirect_to(array('controller'=>'x', 'action'=>'y', 'id'=>'1'))
24                         
25                         // find all 'shoes' with property x being 12
26                         $shoe = new shoe();
27                         $shoe->find(array('where'=>array('x=":x"', 'x'=>'12')))->all();
28                         
29                         // or, simpler
30                         $shoe = new shoe();
31                         $shoe->find_by_x('12')->all();
32                         
33                         // find a shoe with id 14 and respond
34                         $shoe = new shoe();
35                         $this->response->shoe = $shoe->find_by_id('14');
36                 */
37         }