|
|||||||||
|
|||||||||
![]() |
![]() |
Documentation >> Macros >> CounterCounter MacroThis is a very simple macro. It just returns a number indicating how many times the macro has been called on the current page. That's an important distinction: this is not a "web counter," it doesn't tell you how many times a page has been viewed. (Conversant already has enough ways to do that, at least with messages.) Every time a page is requested, the counter starts over at zero, so in other words it's an "in-page counter." Usage
There are two optional parameters for this macro:
Example
Here the macro is used three times:
Which produces these results: See? The first time it returns 1, then 2, then 3. DiscussionThis macro is expected to be useful within templates and macros which generate content, especially a "list" of content or anything in a series. Two easy examples are: within automatically generated paragraph tags, and within search results. In the paragraph tags, you could use this macro to give every paragraph its own id, which would then give you an easy way to refer to specific paragraphs within the page, like this:
... which says "put the message body here, and replace double-spacing with these paragraph tags." Every time it adds another paragraph tag it runs the macro again, and so each paragraph gets a unique id.
(The same could be done with anchor tags, to produce paragraph anchors
like |
![]() |
||||||