[pmwiki-users] pagelist template brainstorming

Patrick R. Michaud pmichaud at pobox.com
Sun Feb 18 09:45:01 CST 2007


On Sun, Feb 18, 2007 at 04:31:21PM +0100, Hladůvka Jiří wrote:
> I do not understand the meaning of
> 
> "before the first record", "after the first
> record", "before the last record", and "after the last record",

In normal templating, I will typically want to have things
that are displayed at the very beginning and very end of
the report.  This is naturally handled by:

    (:first:)
    very beginning of the report
    (:each:)
    each record in the report
    (:last:)
    very end of the report

However, there could be times, which I fully admit would not
be common, in which someone might want something to be displayed
just after the first record, or just after the last record.  For
example, to display just after the first record, one could write:

    (:first:)
    very beginning of the report
    (:each:)
    each record in the report
    (:first:)
    immediately following the first record of the report

Again, I say this won't be common, but I don't see any good
reason to _prevent_ people from doing things like this
(and preventing it would actually require more code).

> Does it mean "after the first record" was displayed ? What is it good for?
> Usually we need to say:
>   Here is the start of the report
>   Hee is the start of {=$:State} grouped records
>   Here starts the {=$:City} in {=$:State} grouped records
>   first record of group {=$:City} in {=$:State}
>   ....
>   last record of group {=$:City} in {=$:State}
>   Here is the end of {$justprocessedCity} in {$justprocessedState}  xxx 
> records displayed
>   Here is the end of {$justprocessedState}  yyy records displayed
>   Here is the end of the report

See my previous message discussing (:first {=$Group}) and
(:last {=$Group}:).  I suspect our messages crossed in transit.

We're currently looking at doing the above with something like:

    (:first:) 
    Here is the start of the report
    (:first {=$:State} :) 
    Here is the start of {=$:State} grouped records
    (:first {=$:State} {=$:City} :)
    Here starts the {=$:City} in {=$:State} grouped records
    (:each:)
    record for group {=$:City} in {=$:State}
    (:last {=$:State} {=$:City} :)
    Here is the end of {=$:City} in {=$:State}
    (:last {=$:State} :)
    Here is the end of {=$:State}
    (:last:)
    Here is the end of the report

At present I don't have a syntax for keeping track of the
number of records in each grouping... but we might be able
to come up with one.  I probably just need a good variable name
for it.  (Hmm... would a simple "{$$Count}" be too generic?)

Pm



More information about the pmwiki-users mailing list