Re: Can't we use $this->set in a loop?

2007-01-03 Thread TJSingleton
You could just move the whole loop to the view and pass the array from the controller to it. I guess it really just depends on what you mean by "on the fly". When I get a chance I'll update my example in the other thread to produce your desired output. On Jan 3, 12:02 pm, "skyblueink" <[EMAIL PR

Re: Can't we use $this->set in a loop?

2007-01-03 Thread skyblueink
Chris, very insightful opinion!! Now it seems to be a time for me to learn something like ajax in cakePHP. Could anyone show me how to apply ajax to my tiny program for doing "on the fly" output? It could present with a good starting point for studying ajax in Cake. On 1월4일, 오전1시35분, "skybluei

Re: Can't we use $this->set in a loop?

2007-01-03 Thread skyblueink
Hi, rpetrain1 yes there is also a synchronization problem between the controller and the view. I know that $this->set doesn't do appending, but appending is time consuming in real life. What I aim at is 'not appending': instead of appending string data, I want to send each datum to view so that

Re: Can't we use $this->set in a loop?

2007-01-03 Thread Chris Hartjes
On 1/3/07, skyblueink <[EMAIL PROTECTED]> wrote: I'm a newbie in CakePHP, but this lack of "on the fly" output in loops seems to be resident in MVC frameworks such as Cake. /me shrugs You're doing a loop either way, so this is a case of perception vs. reality. Perception demands that "on

Re: Can't we use $this->set in a loop?

2007-01-03 Thread rpetrain
The out put that you got is right. When you are using set it is setting the value not appending. In your code you are not printing the value after it has been set each time. By the time the code gets to the call to echo the value of message your loop has already completed and it print outs the la

Re: Can't we use $this->set in a loop?

2007-01-03 Thread skyblueink
Thanks, Chris. But what if the loop takes much time to complete the whole cycle ( $i = 1, 2, 3), and makes the user impatient? The user wants see the first outout for $i =1, and then next output for $i = 2, and so on sequentially rather than to wait for the completion of the whole loop. This is

Re: Can't we use $this->set in a loop?

2007-01-03 Thread Chris Hartjes
On 1/3/07, skyblueink <[EMAIL PROTECTED]> wrote: I have a very simple program. Here is the controller. set('message',"i is " . $i . ""); } } } ?> And here is the view. $this->set doesn't automatically append values. So, your loop should be like this: function pass() { for ($i

Can't we use $this->set in a loop?

2007-01-03 Thread skyblueink
I have a very simple program. Here is the controller. set('message',"i is " . $i . ""); } } } ?> And here is the view. I expected an output like: i is 1 i is 2 i is 3 but the actual output was: i is 3. Does this mean we can't $this->set in a loop? Or am I making a mistake? I just want