[pmwiki-users] new page attribute
Patrick R. Michaud
pmichaud at pobox.com
Mon Sep 25 20:11:20 CDT 2006
On Mon, Sep 25, 2006 at 07:09:58PM -0400, Henrik Bechmann wrote:
> Patrick,
> >When page text variables are implemented (likely for pmwiki-2.2.0-beta2
> >or pmwiki-2.2.0-beta3), then you'll likely be able to do something like:
> >
> > (:Summary:Here is my text summary. It contains a whole paragraph
> > of text:)
> >
> >and you can access it with {$:Summary}.
>
> So in a pagelist format, I could write
>
> (:if ! equal {=$:Summary} '' ) <include the summary field in the
> pagelist output> (:if:)
This will work only if {=$:Summary} is a single line -- if it's
multiple lines, the substitution will break the (:if:) markup.
(I don't have a good answer for this, short of defining a custom
condition, which isn't hard.)
However, if we're just displaying the summary field, it's far more
efficient to simply write
{$:Summary}
> ?? IOW What happens if (:summary: some summary :) doesn't exist? Does it
> return ''?
Yes, if a page doesn't have a defined text field, then the value is ''.
> >...and you can test for the presence of a summary by adding
> >"(:Summary:" as a search term to pagelist.
> >
> I wanted it for *inside* pagelist format rules...
Ah, I thought you wanted to only display pages that had a summary.
> If possible, I actually would prefer what you said to the editor:
>
> there will be a way for administrators
> and recipes to specify that certain properties should be
> saved as page attributes.
>
> ...because that gives me the option to have a separate input field for
> Summary on the edit form. This is more explicit for the authors, and
> also easy to do
>
> $FmtPV['$Summary'] = '$page["summary"]';
Well, you can do that, but if you're setting it up as a separate
input field, it's not really a page text variable or a "property"
in the sense that we've been using that word here. ("Properties"
are values defined in the markup.) It's just another attribute of
the page that is being managed as a separate field.
Pm
More information about the pmwiki-users
mailing list