New core helper: SessionHelper
In the latest version from trunk (1.1.7.3346), a new helper has been introduced: SessionHelper. Up to now it was rather cumbersome to work with session data in the view:
$this->controller->Session->read('User.name');
With the new SessionHelper the code snippet from above looks like:
$session->read('User.name');
The SessionHelper is automatically available in the view, i.e. you do not have to add it to the helpers array in the controller. It provides the following functions:
- read($name = null)
- check($name)
- error()
- flash($key = ‘flash’)
- valid()




Short and simple - Nice addition!
Does PHP have custom variable attributes? In perl you can do this:
my $counter : Session;
print “This is visit number: ” . ++$counter;
http://search.cpan.org/perldoc?Catalyst::Controller::BindLex
I wonder if this feature could be ported
count should be done in the controller for something like this
[...] New core helper: SessionHelper: ”In the latest version from trunk (1.1.7.3346), a new helper has been introduced: SessionHelper. Up to now it was rather cumbersome to work with session data in the view: [...]
hey that’s exactly what i needed :)
i have just downloaded the nightly build, and it’s working nicely by the moment. Will report any bug if I find it (I was using the latest stable version until now but hey let’s try danger!!).
Thanks for the useful tip :)