I want to put a little counter on my page. Currently I have the following. Please tell me how good that is: I declared a property called visitors (integer); I wrote a external method that increases the value of the property: (Is the following code right?) def add_visitor(self): self.visitors = self.visitors + 1 And a display function: def show_visitors(self): return self.visitors Is there a way to do it with DTML only. I do not neccessarily write external methods, but that is the only solution I see. stephan -- Stephan Richter iXL - Software Designer and Engineer
There is some sticky point in this approach. The property is updated in the database and not changed inplace, so you hold all the old values also. (This gives the ability to do a countdown just by undoing :-). If many people use something like this the database grows quickly. Howard Shaw has implemented a counter-product, so perhaps look at his code. I can send you a copy in private mail. HTH __Janko But there should be a counter-product on the zope site, or look Stephan Richter writes:
I want to put a little counter on my page. Currently I have the following. Please tell me how good that is:
I declared a property called visitors (integer); I wrote a external method that increases the value of the property: (Is the following code right?) def add_visitor(self): self.visitors = self.visitors + 1
And a display function: def show_visitors(self): return self.visitors
Is there a way to do it with DTML only. I do not neccessarily write external methods, but that is the only solution I see.
stephan -- Stephan Richter iXL - Software Designer and Engineer
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
On Tue, 10 Aug 1999, Stephan Richter wrote:
I want to put a little counter on my page. Currently I have the following. Please tell me how good that is:
I declared a property called visitors (integer); I wrote a external method that increases the value of the property: (Is the following code right?) def add_visitor(self): self.visitors = self.visitors + 1
And a display function: def show_visitors(self): return self.visitors
Is there a way to do it with DTML only. I do not neccessarily write external methods, but that is the only solution I see. <dtml-call "changeProperties(visitors=visitors+1)">
But it's just from my head without trying, so the method might be called differently. Andreas -- Andreas Kostyrka | andreas@mtg.co.at phone: +43/1/7070750 | phone: +43/676/4091256 MTG Handelsges.m.b.H. | fax: +43/1/7065299 Raiffeisenstr. 16/9 | 2320 Zwoelfaxing AUSTRIA
participants (3)
-
Andreas Kostyrka -
jhauser@ifm.uni-kiel.de -
Stephan Richter