[pmwiki-users] New template expression markup....

Hans design5 at softflow.co.uk
Tue May 1 03:45:44 CDT 2007


Tuesday, May 1, 2007, 1:42:07 AM, The Editor wrote:
> [...]
> (:template <datapage> <templatepage>:)

> It opens the datapage, explodes the content by the anchors, inserts
> the data values into the template, and then re-implodes the output and
> sends it back to the page.  All the data is cleanly stored on one
> page.  And the template can be instantly updated sitewide.  The best
> of both worlds!

> I wrote out the code this morning but haven't had a chance to test or
> debut it yet.  Should be able to finish tomorrow.  Any thoughts?

Kathryn is right; don't use (:template ...:).

Otherwise very interesting. A short while ago I had a discussion about
this with Feral. We were polishing her new recipe FeralFormattedEntry
http://www.pmwiki.org/wiki/Cookbook/FeralFormattedEntry
which provides a kind of data container markup, and uses a template
for formatted display of its data content. Data is stored as parameter
values inside the markup, for instance

(:ffe heading="A new entry" author="Jim" template=Site.BlogTemplate:)
Some text
from a textarea input box.
(:ffeend:)

(:ffe heading="reply to you" author="John" template=Site.BlogTemplate:)
What is all this about?
more text lines...
(:ffeend:)

One advantage to what you are proposing is that every entry can have
its own template specified. Nice for instance for a blog where the
first topic entry can look quite different than all the reply comments.
The other difference is that it does not use anchors to split the page
into different data entry sections, but the markup acts like a
container. So, this is working and you can play with it. I like to use
it for displaying forum posts with display templates.

So then I thought: we could expand this and allow PTVs inside the
(:ffe :) ... (:ffeend:) container. I actually generalised Feral's
script to this extend for testing out this idea. So one could create a
page with

(:ffe template=Site.BlogTemplate:)
(:heading:A new entry:)
(:author:Jim:)
(:text:
Some text
from a textarea input box.
(:ffeend:)

(:ffe template=Site.BlogTemplate:)
(:heading:reply to you:)
(:author:John:)
(:text:
What is all this about?
more text lines...
(:ffeend:)

But Feral's main objection was that we are creating "pseudo PTVs" and
that the source code looks less tidy and not so easy to edit later
than her own ffe markup.

The point about pseudo PTVs is certainly true and applies to your
approach as well. PTVs are at the moment restricted, as all PTVs on one
page should bear unique names. So reusing PTV names in multiple data
sections of  a page is against how PmWiki defines PTVs, and is not
suitable also for how PmWiki handles PTVs, for instance in pagelist
searches.

A concept of multiple data sections on a page using some sort of PTV
needs to address this and really creates a new type of PTV, perhaps
better called SectionTextVariable, or STV. And this may indeed be very
useful.


  ~Hans




More information about the pmwiki-users mailing list