"Richard P. Muller" wrote:
I'm in the process of learning Zope hacking, and I'm having a really
hard time getting a page counter to work. It isn't even that page
counters are all that important to me, it's that I feel that if I can't
even do something this simple, what hope do I have doing something
really hard?
The ZODB is a _really_ bad place to store a page counter, especially on
a busy site.
Data.fs will grow each time your counter increments. This is because
it's a transactional daatbase with undo ability...
Here's what I've done.
(1) Under "Properties" I've created two properties (both ints)
counter_starting_value, which I've set to 11 (arbitrarily)
counter_value, which I've set to 0
Sounds good :-)
dtml-if counter_value
dtml-let counter_value = counter_value + 1
/dtml-let
dtml-else
dtml-let counter_value = counter_starting_value
/dtml-if
dtml-var counter_value
This didn't work. The error message reported that the syntax in the
first (and probably the second, but I never got past the first) dtml-let
command was wrong.
Whoops, just remember this:
DTML is not a programming language, it is designed for data presentation
and form processing. Or something like that ;-)
To do what you want, you probably want something like:
dtml-call
"manage_changeProperties(counter_value=getProperty(counter_value,counter_starting_value-1)+1)"
Which isn't pretty :S
cheers,
Chris
___
Zope maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope-dev )