[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

global variables /rexml / caching

paul vudmaska

9/12/2003 11:25:00 PM

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...