Date index for Sep 2003


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [achievo] Refreshing display after editing sub-node (atkOneToMany)



Hi,

Sebastian Paul Avarvarei wrote:

I guess situations like mine are not very common, so re-reading read-only
attributes from database each time would not be maybe the best use of
resources.

Well, it *is* already loaded from the db. What it does is load the record from the db, and then overwrite this data with the values that are in the stack, if available. One reason is that we do not have to rely on the session data. If it's available it's used, if it's not for some reason, no problem, it'll still work, only not with cached data.


Yes, doing on a per-attribute basis might be a better ideea. Maybe with a
new flag, something like "DONT_CACHE", meaning that the attribute would
always be loaded from the databases instead of getting its value from the
cache/stack.

Only, we have run out of flags. :(
PHP doesn't allow us to do bitwise operations on numbers of more than 32 bits. This means we can have only 31 flags (the 32nd bit is for the sign), which we already have. So adding flags is not an option..


Coming back to the problem at hand (stacks), I was wondering if it is
possible to access and modify the stack directly. I noticed there is a
g_sessionManager->stackVar() method, but that one only allows me to
acces/modify a "cached" attribute for the current page/level.

The most direct (hence dirty) way of hacking the stack is by accessing $g_sessionData, which is the global array containing everything related to ATK sessions.


It is an array with 'namespaces'. In normal situations, you'll only find one namespace (only when running multiple ATK apps on the same domain, you'll have more namespaces), which contains an attribute "stack", which is a subarray containing the complete stack. Actually, multiple stacks are in there if you use multiple browser windows. The one you need is the one that is stored with the key that is returned by atkStackID().

If you search atk/session/class.atksessionmanager.inc for the word 'stack', you'll find some useful statements to help you get to the stack. It would not be difficult to add a getStack() method to the session manager.

Would it be possible to access the stack for the previous level? And would
it be wise? ;)

Well, no. I tend to rely on the stack as little as possible. But sometimes, it's just something you have to do. :)


Greetings,
Ivo



http://www.achievo.org/lists achievo.org - ©1999-2002 ibuildings.nl BV