On Mar 18, 2011, at 04:24, varai wrote:

> I'm new to cakePHP and OOP.
> 
> I'm not understanding
> 1)what find('all') in the following code means

find('all') finds all records in this model's database table and returns them 
to you as an array.

> 2) what is the purpose of  $this->set('ingredients', $ingredients);

This sets the variable 'ingredients' (in the view) to the value of the variable 
$ingredients (here in this controller method), so that you can display it in 
the view.

> I got this from book.cakephp.org.
> 
> <?php
> class IngredientsController extends AppController {
>    function index() {
>        //grab all ingredients and pass it to the view:
>        $ingredients = $this->Ingredient->find('all');
>        $this->set('ingredients', $ingredients);
>    }
> }
> 
> ?>

Spend some more time reading the book and looking at example CakePHP projects. 
Hopefully it will become clear to you how it all works together.




-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to