- Seme Framework
- version 4.0.3
- Requirements
- Download & Install
- Configuration
- Tutorials
- URI Routing
- Constants
- Global Variables
- Model
- View
- Controller
- cdn_url
- config
- constructor
- getAdditional
- getAdditionalBefore
- getAdditionalAfter
- getAuthor
- getCanonical
- getContentLanguage
- getDescription
- getIcon
- getJsContent
- getJsFooter
- getJsReady
- getKey
- getKeyword
- getLang
- getRobots
- getShortcutIcon
- getThemeElement
- getTitle
- input
- lib
- load
- loadCss
- loadLayout
- putThemeContent
- putJsContent
- putJsFooter
- putJsReady
- putThemeContent
- render
- resetThemeContent
- session
- setAuthor
- setCanonical
- setContentLanguage
- setDescription
- setIcon
- setKey
- setKeyword
- setLang
- setShortcutIcon
- setTheme
- setTitle
- Library
- CLI (command line interface)
- Core
- Issue
- Deployment
setKey Method
Method setKey()
from SENE_Controller class allowed you to pass array of object or objects to save in session.
Example
Here is the example usage for getKey()
method and setKey()
method.
class Home extends SENE_Controller{
public function __construct(){
parent::__construct();
}
private funtion __init(){
$data = array();
$sess = $this->getKey();
if(!isset($sess->user_login)) $sess->user_login = 0;
if(!isset($sess->user)) $sess->user = new stdClass();
if(isset($sess->user->id)) $sess->user_login = 1;
$this->setKey($sess);
$data['sess'] = $sess;
return $data;
}
public function index(){
$data = $this->__init();
}
public function set_logged_in(){
$sess = $this->getKey();
if(!isset($sess->user_login)) $sess->user_login = 1;
if(!isset($sess->user)) $sess->user = new stdClass();
if(!isset($sess->user->id)) $sess->user->id = 1000;
$this->setKey($sess);
}
public function set_logged_out(){
$sess = $this->getKey();
if(!isset($sess->user_login)) $sess->user_login = 0;
if(!isset($sess->user)) $sess->user = new stdClass();
if(!isset($sess->user->id)) $sess->user->id = 1000;
unset($sess->user->id);
$this->setKey($sess);
}
}