You know sometimes, in CakePHP’s views, it is useful to check what is the controller’s action. It is quite useful when it comes to implementing selected tabs.
You can use the following expression to get the action name from your view:
The following is a usage example:
[code lang=“php”]<?php /* This is a view element file - nav_messages.thtml */ ?>
<?php $s = $this->controller->action; ?>
“messages_inbox” and “messages_sentbox” is the name of the action (function) in my controller.
This way you can get the list tabs to be selected visually. There is a class named “selected” that is defined in the CSS. I tested this on CakePHP 1.1. The code works if it’s in an element too.
I just realized my code font size is too huge.