开发者

how do i access the session variables in the pages

开发者 https://www.devze.com 2023-02-27 10:38 出处:网络
how do i access the session varia开发者_C百科bles in the pages in agile toolkit. i am using $this->getUser() but it is not workingIn agile toolkit each object can register session variables. This is d

how do i access the session varia开发者_C百科bles in the pages in agile toolkit. i am using $this->getUser() but it is not working


In agile toolkit each object can register session variables. This is done to allow you to have multiple objects work indecently and not conflict.

Basic functions are:

$o->memorize('handle',123);

$o->recall('handle');

$o->forget('handle');

If you intentionally wish to share data, then you can use

$o->api->memorize('my_global_var',123);

Since you mentioned about User ID, then authorization object handles its own variables. Similarly it uses memorize/recall to manipulate auth data settings, but you can get the information like this:

$user_id = $o->api->auth->get('id');

When $auth->check() is performed, all fields returning by the query are saved. If you wish to add more fields, then perform

$auth->dq->field('extrainfo');

and this field will be selected by DSQL and stored in session too for further retrieval by $auth->get('extrainfo')

To create getUser function, typically you would define this in API:

function getUser(){
    return $this->add('Model_User')->loadData($this->auth->get('id'));
}

and use $this->api->getUser() to retrieve the data.

0

精彩评论

暂无评论...
验证码 换一张
取 消