hi,
Can someone can tell me the difference between using $this-
set('data', array()) and $this-data in controller.
I am especially getting confused about this in relation to form. In
general to send data to view, we have to set the variable using $this-
set(data, array). But to set the form, we
$this-set('yourvar', $somedata) will create a variable called
$yourvar in the view, with the passed data. $this-data is model data
that is from/for a form - all of the FormHelper functions look at
$this-data to prepopulate from, and all the data they submit comes
into your controller under
And in case you weren't aware - you can access $this-data directly in
both the view and the controller. So in your view you can have
something like:
h2Change password for `?php echo $this-data['User']['name']; ? /
h2
?php echo $form-input('User.password'); ?
and both parts here will access the
the difference between using $this-set('data',
array()) and $this-data in controller.
I am especially getting confused about this in relation to form. In
general to send data to view, we have to set the variable using $this-
set(data, array). But to set the form, we need to use $this-data
bingo
the difference between using $this-set('data',
array()) and $this-data in controller.
I am especially getting confused about this in relation to form. In
general to send data to view, we have to set the variable using $this-
set(data, array). But to set the form, we need to use $this-data
bingo
$this-data is also available in your view in Cake 1.2. It is a copy
of $this-data that is in the controller.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to