When I have if statements for views I make a helper to simplify the code
rather than if this if that all over the places, simply pass the variables
to the helper and get the values I need returned.
But what about for the controller? I have a rather ugly block of code used
in a few places and it sure would streamline changes. Where should code like
this go? Its used in about 7 places and its rather horrible
Example :
if ( !empty( $auth_id ) ) {
$rank = $this->Auth->user( 'rank' );
$display = $this->Session->read( 'Settings.display' );
$tests = $this->Session->read( 'Tests.sent' );
if ( empty ( $tests ) ) {
$tests =
$this->Test->Application->getAllApplications($this->Auth->user('id'),
$this->Auth->user('rank'));
$this->Session->write( 'Tests.sent' , $tests);
}
$tests = $this->Session->read('Tests.sent');
} else {
$rank = '0';
$display = '0';
}
Thanks
Dave
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en