how do I pass a variable declared in a function in a cakePHP component to a controller? I can’t seem to work this out.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do it a number of ways. Basically, you just call the component’s functions that you need from the controller and return values:
Per the documentation, you also have direct access to the controller from the component so you can call controller methods from the component.