Re: Accessing data from controller in view

2010-04-30 Thread Andrei Mita
That is exactly how I'm using it. Thanks On Thu, Apr 29, 2010 at 6:11 PM, Jeremy Burns jeremybu...@me.com wrote: So why not: echo 'Modifying profile for ' . $this-data['Profile']['name']; ? PS: What's the future like? Jeremy Burns jeremybu...@me.com jeremybu...@mac.com On 29 Apr

Accessing data from controller in view

2010-04-29 Thread Andrei Mita
Hello, In a basic CRUD application I have a user's profile edit page. When /profiles/edit/4 page is accessed the action in the controller checks if an id is passed, then if I have some data to be saved. If the id is present but no data, it reads the id related data and then pass it to a view like

Re: Accessing data from controller in view

2010-04-29 Thread Jeremy Burns
Try: $this-Form-value('Model.field_name'); Jeremy Burns jeremybu...@me.com (Skype) +44 208 123 3822 (jeremy_burns) (m) +44 7973 481949 (h) +44 208 530 7573 On 29 Apr 2010, at 15:14, Andrei Mita wrote: Hello, In a basic CRUD application I have a user's profile edit page. When

Re: Accessing data from controller in view

2010-04-29 Thread Andrei Mita
In the view? If yes, I get this: *Notice* (8) javascript:void(0);: Undefined property: View::$Profile [*APP/views/profiles/edit.ctp*, line *17*] Code javascript:void(0); | Context javascript:void(0); $___viewFn = /var/www/fotopoetica/app/views/profiles/edit.ctp $___dataForView =

Re: Accessing data from controller in view

2010-04-29 Thread Jeremy Burns
Works for me - I'm on 1.3 - are you? Jeremy Burns jeremybu...@me.com On 29 Apr 2010, at 15:24, Andrei Mita wrote: In the view? If yes, I get this: Notice (8): Undefined property: View::$Profile [APP/views/profiles/edit.ctp, line 17] Fatal error: Call to a member function value()

Re: Accessing data from controller in view

2010-04-29 Thread Andrei Mita
Terribly sorry for the whole controller dump. I only meant this: Notice (8): Undefined property: View::$Profile [APP/views/profiles/edit.ctp, line 17] Fatal error: Call to a member function value() on a non-object in /var/www/fotopoetica/app/views/profiles/edit.ctp on line 17 On Thu, Apr 29,

Re: Accessing data from controller in view

2010-04-29 Thread Andrei Mita
1.2.7 i believe. On Thu, Apr 29, 2010 at 5:32 PM, Andrei Mita andrei.m...@gmail.com wrote: Terribly sorry for the whole controller dump. I only meant this: Notice (8): Undefined property: View::$Profile [APP/views/profiles/edit.ctp, line 17] Fatal error: Call to a member function

Re: Accessing data from controller in view

2010-04-29 Thread Jeremy Burns
What does line 17 look like? What version are you on? Jeremy Burns jeremybu...@me.com On 29 Apr 2010, at 15:32, Andrei Mita wrote: Terribly sorry for the whole controller dump. I only meant this: Notice (8): Undefined property: View::$Profile [APP/views/profiles/edit.ctp, line 17]

Re: Accessing data from controller in view

2010-04-29 Thread Jeremy Burns
OK - that might be it then. Only just discovered this functionality - maybe it's a 1.3 thing. What's in $this-data? Jeremy Burns jeremybu...@me.com On 29 Apr 2010, at 15:33, Andrei Mita wrote: 1.2.7 i believe. On Thu, Apr 29, 2010 at 5:32 PM, Andrei Mita andrei.m...@gmail.com wrote:

Re: Accessing data from controller in view

2010-04-29 Thread Andrei Mita
line 17: legend?php __('Modifica Profil - '.$this-Form-value('Profile.name'));?/legend I'm on 1.2.7 stable. On Thu, Apr 29, 2010 at 5:34 PM, Jeremy Burns jeremybu...@me.com wrote: What does line 17 look like? What version are you on? Jeremy Burns jeremybu...@me.com jeremybu...@mac.com

Re: Accessing data from controller in view

2010-04-29 Thread Andrei Mita
I populate $this-data like this: function edit($id=null){ ... if (empty($this-data)) { $this-data = $this-Profile-read(null, $id); ... } On Thu, Apr 29, 2010 at 5:38 PM, Jeremy Burns jeremybu...@me.com wrote: OK - that might be it then. Only just discovered this

Re: Accessing data from controller in view

2010-04-29 Thread Jeremy Burns
Why not install the debug kit - it shows you all of your variables - might expose something? I use it all the time now. Jeremy Burns jeremybu...@me.com On 29 Apr 2010, at 15:33, Andrei Mita wrote: 1.2.7 i believe. On Thu, Apr 29, 2010 at 5:32 PM, Andrei Mita andrei.m...@gmail.com wrote:

Re: Accessing data from controller in view

2010-04-29 Thread Jeremy Burns
What happens if you: die(debug($this-data)); ... in the view? Jeremy Burns jeremybu...@me.com On 29 Apr 2010, at 15:42, Andrei Mita wrote: I populate $this-data like this: function edit($id=null){ ... if (empty($this-data)) { $this-data =

Re: Accessing data from controller in view

2010-04-29 Thread Andrei Mita
outputs the data: Array ( [Profile] = Array ( [id] = 1 [name] = Andrei Mita [birth_date] = 2030-09-23 On Thu, Apr 29, 2010 at 5:50 PM, Jeremy Burns jeremybu...@me.com wrote: What happens if you: die(debug($this-data)); ... in the view?

Re: Accessing data from controller in view

2010-04-29 Thread Andrei Mita
I did it: echo $this-data['Profile']['name'] solved the problem. I was using $session-params['path']['url']['url'] in some other place but it didn't cross my mind to use it for data. Thanks for your time. On Thu, Apr 29, 2010 at 6:02 PM, Andrei Mita andrei.m...@gmail.com wrote: outputs the

Re: Accessing data from controller in view

2010-04-29 Thread Lucca Mordente
echo $this-data['Profile']['name'] should output what you want! On 29 abr, 12:02, Andrei Mita andrei.m...@gmail.com wrote: outputs the data: Array (     [Profile] = Array         (             [id] = 1             [name] = Andrei Mita             [birth_date] = 2030-09-23 On Thu,