This site is built using CakePHP 1.2*
I have an element that needs to be placed in multiple views under multiple controllers. This element is very dynamic, every time a page is loaded it needs to call a function (which is rather large) and then display what was returned.
There are a few options that I have thought of, none of which I am sure are the correct way of doing this.
- Placing this function within app_controller and then somehow calling it from the element
- create a helper and then including it in every controller that will display the element.
- creating a component and then including it in every controller that will display the element.
Any help is appreciated in the correct way of doing this. Currently the element is being placed on multiple pages under multiple controllers and is calling the function using $this->requestAction()
which from what I understand is certainly not the correct way.
Thanks in advance!