I am using CakePHP 1.2. I am studying the logic of CakePHP code written by someone else. I am examining the following controller:
<?php
// For serving up images or other files.
class ImagesController extends AppController
{
function __setupDir($destination)
{
..........
}
function view()
{
..........
}
}
?>
I know CakePHP has conventions that define how specific actions are called when requests match a URL. For example, given my ImagesController above, I would need to have this file:
app/views/images/view.ctp
Then I would need to point the browser for example to something like this:
http://localhost/myapplication/images/view
That should execute the "view()" function defined for the ImagesController controller mentioned above. This is how the CakePHP 1.2 conventions work.
According to https://book.cakephp.org/1.2/en/The-Manual/Developing-with-CakePHP/Controllers.html, "actions are controller methods used to display views. An action is a single method of a controller." In my case, the "view()" function is an action, but in the application from what I see it is not being used to display a view. In the code I am studying, what I see is that sometimes when pictures or images are loaded in the website, the "view()" function of the ImagesController controller is executed. I am trying to understand exactly what triggers this "view()" function. I know it is not happening when visiting http://localhost/myapplication/images/view. Is there an alternative way to execute a controller action in CakePHP in general, or particularly in CakePHP 1.2? I just need to know and find the code that triggers this "view()" function. Thank you.
Debugger::log('foo')
. book.cakephp.org/1.2/en/The-Manual/Common-Tasks-With-CakePHP/… – ndmdebug_backtrace()
, and should only excludecall_user_func_array
andtrigger_error
. So if there are no further entries, chances are that there is no further code involved. You can try to get a formatted stacktrace from an exception object ($ex = new Exception(); $trace = $ex->getTraceAsString()
), but the results will probably be similar. – ndm