just started my phpcake adventure. I got a migraine from all this MVC.
//Controller file
class UsersController extends AppController { public function index() { $this->User->recursive = 0; $this->set('users', $this->paginate()); } }
//view file, so i'm passing in $users into the view file
<table> <tr> <th>Id</th> <th>Name</th> <th>Password</th> </tr> <?php foreach ($users as $u): ?> <tr> <td><?php echo $u['User']['id']; ?></td> <td><?php echo $u['Post']['username']; ?></td> <td> <?php echo $u['Post']['password']; ?></td> </tr> </table>
In my sql, my columns are id,username and password
$u['what am i suppose to put in here' ]
In the cake php tutorial i used Post but i'm wondering what the Post is referring to Post method? or Post from the controller name? And whats the difference between paginate and $this->set('users', $this->Post->find('all'));
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment