global variables /rexml / caching

P

paul vudmaska

A recent thread talks about using a global class to
tuck variables in rather than have them polute a
namespace. I think this is a good idea(and is one of
the reasons java simply does not allow it).

I keeping all my 'globals' in an xml file using
rexml.. like db connects, prod flag, etc. Right now
this file is loading everytime (until I can figure out
how to cache it). I least i thot it was not caching...

I have are toolbar items in my global
xml.<toolbar><items/><toolbar> and when i'm outputting
them, i check to see of the client is logged on or off
and create, on the fly, an element accordingly, and
append it to items. However, if i refresh, i find that
these elements are accumulating. When i output the
rexml, indeed, they are accumulating but i do not know
why. It's either looping over my logic(don't know
how!) or it's caching the xml file for some reason.

<code>
#Are we logged on?
#Dynamically add an element to the globals for the
toolbar
#To show logon or off

eItem = REXML::Element.new 'item'

if $sess.data['on']to_i == 1 then

eItem.attributes['name'] = 'Logoff'

eItem.text = "/?cnt=adm/logon/index&logoff=1"

else


eItem.attributes['name'] = 'Logon'

eItem.text = "/?cnt=adm/logon/index"

end

eRight =
$global.root.elements['Html/Toolbars/Main/Right']

eRight << eItem

#s = ''
#$global.write(s,1)
#print CGI.escapeHTML(s)

print $html.formatToolbar eRight

</code>

As anyone experienced this. I would sure like to cache
it at some point but wish i were doing it on my own!

:p

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,125
Messages
2,570,748
Members
47,302
Latest member
MitziWragg

Latest Threads

Top