Tuesday, February 23, 2010

Checking existence of variable passed to an element

I am a bit of newbie with CakePHP and DB-driven sites so bear with me.

I have an element that I am displaying on every page, and I am passing
one variable to it from every controller function. If I do not pass
the variable I get an ugly unknown variable error.

I want to ease the requirement of passing the variable by not
displaying the relevant HTML from the element if the variable has not
been passed (avoiding the ugly unknown variable error).

Where would the logic for this go? My best guess is the
AppController. Second guess is creating a component for this. What's
the right thing to do?

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: