Hi, Signleton!

OK, let's see the original Controller.

 function pass() {
   $result = array();
   for ($i = 1; $i <= 3; $i++) {
      $result = am($result, $this->Test->myfunction($i));
   }
   $this->set('result',$result);
 }


(1) The above code will give an output:

lemon
banana
apple
lion
tiger
monkey
red
blue
green

We have to wait until the loop cycles ($i = 1, 2, 3) are completed to
get each of the 3-element array of:
array("lemon", "banana", "apple"),
array("lion", "tiger", "monkey"),
array("red", "blue", "green")
and then we merged the the three arrays using am() to deliver to View.

(2) What I want to do.
But, let's suppose the loop completion(from $i = 1 to $i = 3) takes too
much time (in real life), so we decided to deliver each of the three
arrays respectively. After the cycle of $i = 1 in the loop, we have
$this->Test->myfunction(1), and deliver it to View immdeiately so that
the user of this program can see lemon, banana, apple as the first
output. After the cycle of $i = 2, we send $this->Test->myfunction(2)
to View, and the user can see lion, tiger, and monkey as the second
output, and so on.

The output will be:
lemon
banana
apple
lion
tiger
monkey
red
blue
green

The same output as the previous one? Yes, but in (1) the user had to
wait wondering what's going on behind the terminal until all of the
fruits, animals, and colors are displayed as an output at once while in
(2) the user firstly gets the fruits output, secondly animals output,
and thirdly colors output sequentially without wondering what's going
on behind. Basically it's a "waiting time" problem, and (2) is
preferred to (1).
Furthermore, to delimitate the sequential outputs, placing headers
would be better.

Header 1: fruits are here.
lemon
banana
apple
Header 2: animals are here.
lion
tiger
monkey
Header 3: colors are here.
red
blue
green


On 1 3 ,   2 09 , "TJSingleton" <[EMAIL PROTECTED]>
wrote:
skyblueink wrote:
> Without using CakePHP or any other MVC framework, I would have
> codedlike the following:Can you give me an example of the final output you'd 
like it to
achieve?

--
TJ Singleton


--~--~---------~--~----~------------~-------~--~----~
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