You use the Helper in the View like
$return = $MyHelper->doSomething();
The Helper looks like:
Class MyHelperHelper extends AppHelper {
function doSomething() {
return $this->output("some value");
}
}
$return
is now "some value"
.
You return values just like any other function. Where's the specific problem?
UPDATE:
After seeing your updated question:
You can't "poll" data from a Controller in the View*
. If you have to, you should work on your data flow. The way it's supposed to work is that the Controller prepares all the data that you need to output in advance (with the help of Models and/or Components where necessary) then passes all that data to the View. The View itself should really only be concerned with displaying the data it has been given, there should be no need for it to request any more data.
Think of the flow like this:
Request
|
v
Model <-> Controller <-> Components
|
v
Elements <-> View <-> Helpers
|
v
Elements <-> Layout <-> Helpers
|
v
Output
You can't really "reach up the chain", you can only pass data down.
*)
Well, technically you can using requestAction()
, but it's usually overkill and has a few implications.
Do you have any more specific code you can show to clarify your question?