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 the problem I'm confronted with.
Of course your code gives the same output the following will give, but
it makes the user wait until the loop is completed, while the following
does not make the user wait by giving outputs sequentially, and and
makes the user happier.

 function pass() {
    for ($i = 1; $i <= 3; $i++) {
      echo "i is " . $i . "<br>";
    }
 }

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.


On 1 4 ,   12 25 , "Chris Hartjes" <[EMAIL PROTECTED]>
wrote:
On 1/3/07, skyblueink <[EMAIL PROTECTED]> wrote:







> I have a very simple program.

> Here is the controller.
> <?php
> class TestsController extends AppController {
>   var $name = 'Tests';

>   function pass() {
>      for ($i = 1; $i <= 3; $i++) {
>        $this->set('message',"i is " . $i . "<br>");
>      }
>   }
> }
> ?>

> And here is the view.$this->set doesn't automatically append values.  So, 
your loop should
be like this:

function pass() {
    for ($i = 1; $i <= 3; $i++) {
        $message .= "i is ". $i . "<br>";
    }

    $this->set('message', $message);

}Hope that helps.

--
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark -http://www.littlehart.net/attheballpark
@TheKeyboard -http://www.littlehart.net/atthekeyboard-            --           -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to