English 中文(简体)
how do i access the session variables in the pages
原标题:
  • 时间:2011-04-21 16:51:33
  •  标签:
  • atk4

how do i access the session variables 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.





相关问题
How to make a field "autocomplete"?

I can t figure out how to make a field autocomplete in ATK. I guess it has something to do with the type "reference" but still not sure. Suppose I m looking for a client name in a "line" type field, ...

How to create a "New xxx" popup?

I have a Grid object and added a [ (+) New Client ] button which I d like to open a popup form to create the new client with a couple fields. I ve looked at the code examples in the website but haven ...

Inline-editable fields goes away on clicking them

When I just load the page there are all the fields, but when I click on them, then the clicked field just disappears. However, no changes are applied to DB. This is the code: function ...

ATK4 and file upload

I am using controller_filestore and it gives error Method addCondition is not defined neither in controller_filestore, nor in its Model. If I use controller_filestore_image, it doesn’t find the class....

Help with atk4-web, atk4-example ver. 4.03

I don t now where can I find help. None forums about atk4. Can you help me, please? atk4-web (4.0.3): How run atk4-web localy, where is site dump (mysql database)? What is mean this error: No such ...

ATK4 - subfolder under page folder and js/css issue

I am using agile toolkit for one of my projects. When I create a sub folder under page folder, CSS and JS are not picked from atk4 folder and I have to copy those css and js under templates folder. Is ...

热门标签