I have to use the session in cakephp helper.
To read the session is possible in helper but write session is not.
I don't know how to do it.
Can anyone tell me?
Basic problem is that:
I have created one custom helper which call several times in view for single request.
Suppose helper has called for 5 times.
In helper for textarea some random id has going to be assign.
I need to collect those ids in some variable and then use it for the js function.
If you have new idea related to this problem then please share.
I have added the "session helper" in my custom helper.
Thanks!!!
You can extend SessionHelper , for that place a create a ExtendSessionHelper.php in View/Helper
and add following code in it.
App::uses('SessionHelper', 'View/Helper');
class ExtendSessionHelper extends SessionHelper {
public function write($name, $value = null) {
return CakeSession::write($name, $value);
}
}
Use following code in helpers array of controller to use this helper
var $helpers = array( 'Session' => array('className' => 'ExtendSession'));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.