Have you ever tried to open a project after a while and think: "I know that this html lies in some view, maybe some controller view... maybe a sub-view or some widget view...."
Now this problem is solved! Just install this widget, set a new debug constant (LOG_VIEW_NAMES) and you will get developer-friendly comments in your html like:
<!-- BEGIN C:\www\mySite\protected\components\views\hotelList\list.php -->
/* all view html */
<!-- END C:\www\mySite\protected\components\views\hotelList\list.php -->
Usage ΒΆ
Unzip the content in an included folder (components, for example).
Make all your controller to extend the loggin controller:
class MyController extends ZLoggingController
If you use Gii generated application, you already have a masterclass for controller. Just edit the first line of the file protected/components/Controller.php:
class Controller extends ZLoggingController
And all views and subviews will be logged.
For log widgets, edit widgets in order to extend the class logging widget:
class MyWidget extends ZLoggingWidget
The log will not be displayed as default. If you want to log, add this line in index.php:
defined('LOG_VIEW_NAMES') or define('LOG_VIEW_NAMES',true);
Nice idea
Thanks for sharing the idea.
Thank you!
I run in this problem this morning, and I was amazed about how a 5 minute work can save you lot of boring searching time.
I am really glad you appreciate!
controller name
What happens if you want a controller named LoggingController so you can have paths
/logging/*
?The base controller name should have another format: something entirely different from actual web controllers.
re: rudiedirkx
You are 100% right.
I updated the extension prepending my beloved 'Z as Zaccaria' in order to avoid such conflicts.
Thank you very much for pointing this problem.
Brilliant!
I love this, very simple to use and wow! It will definitely save time especially when returning to a project.
Two thumbs way up!
doodle
pseudo-bug fix
The ending tag for the HTML comment you are using should be --> and not --!>
While browsers seem to not have a problem with it, there are certain cases when this gets in the way of development.
I am also curious about how you and other people solved the problem of having to extend Controller from some other needed class, such as RController (when using the "rights" module for example) but still needed to use viewlogger..
Other than that, an excellent small extension that I am using regularly.
Thank you radoo
Thank for the fix, I corrected the extension.
With this detail it works correctly also with IE9!
Abuout your question, I am patiently editing all controller classes.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.