Hello Marius,
Wednesday, June 28, 2000, 12:38:17 PM, you wrote:
> I've had some problems with the scope of a variable.
> I need a variable which can maintain it's value throughout all the pages
> of my web-site.
> I've tried to define a variable in "code-global". It worked fine, but it
> seems that when I retrieve a new page it loses its previous value and it
> is initialized with its initial value declared in "code-global" .
> In other words how can I "obtain" a "global" variable.
> I've also tried with environment variables (putenv,getenv) but this
> also looses its value (I verified this also with phpinfo()).
> As I know in such a case I can use cookies, but I do not want .
Depending of how you're using global variables and Midgard version, you could:
1) Add its value as a query parameter (/foo/bar.html?variable=value),
then check in code-global !isset($variable) for setting default
value. (Works in any Midgard version)
2) Store global value as extensible record field with some
session-specific value and pass this value as query info
(/foo/bar.html?sessionid=value), then retrieve extensible record field
with name based upon sessionid -- works for versions >= 1.4beta3
3) Create anonymous user for visitor, store value in person's fields
(see personalization in Manual for more), and pass person's ID as
session value (using active pages it could be like constructing pages
with /foo/{personid}/bar.html where {personid} is value of person ID,
for example -- /foo/6321/bar.html). Then use $argv/$argc in
code-global for selecting correct session (in this case -- person ID).
(Works in any Midgard version)
--
Best regards,
Alexander mailto:[EMAIL PROTECTED]
--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org
To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]