Monday, June 28, 2010

Re: Functions does not find global in views?!!

Why are you creating the variable again, and why is it global?

Jeremy Burns
Class Outfit

jeremyburns@classoutfit.com
http://www.classoutfit.com

On 29 Jun 2010, at 00:13, saidbakr wrote:

> Hi,
> I set to a view variable called $tests and it is array of some data.
> In the view, print_r($tests) prints out the array construction
> correctly and without any problems.
>
> In the regarded view, I created a function to perform a simple task on
> the values of $tests. However, when I try to define the variable
> $tests as global in the function, it seems that the function could not
> able to catch this variable.
> print_r($tests);
> function foo(){
> global $tests;
> // do some logic & code
> }
>
> I don't know why I got this strange result in the view file?!
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: