[Pmwiki-users] can i get a "live" sidebar? / conversion script
Knut Alboldt
mailing
Fri Oct 15 15:20:16 CDT 2004
(sorry Patrick for sending twice, didn't change the receipient to the maillist)
Oh, thanks a lot !
I put this into the docs
(http://www.pmwiki.org/pmwiki2/pmwiki.php/PmWiki/Directives) (please have a
review)
I think that's what I need to migrate the =if* stuff to version 2.
concerning: "All that remains now is to come up with a good set of
$Conditions.":
I also implemented some =if's in version 1, maybe some are usefull to be
defined as $Condition:
- os: to rectrict output to certain operating systems
- host/computername: to restrict output to certain hosts
- editor/admin etc: to restrict output (e.g. buttons edit-links etc) to
editors / admins only
(I'll find out how to define that and add this to the docs, give me some
time ... :-)
Knut
At 20:32 15.10.2004, Pm wrote:
>On Fri, Oct 15, 2004 at 07:17:40PM +0200, Knut Alboldt wrote:
> > I'm using "living sidebars" using "my" recipe
> > (http://www.pmwiki.org/wiki/Cookbook/IfGroup) in version 1. This gives the
> > possibility to expand / collapse the sidebar according to the group (but
> > not within the pagename - yet)
> > To implement in v2 this I want to use the new "if"-tag (see my question in
> > former mailings) cause it makes more sense to me to use existing functions
> > (e.g. [:if $Group=="somegroup":] rather then inventing new (=ifgroup
> > somegroup) , but I didn't found out how I can use it (what is the syntax /
> > parameters / variables i can use ?).
>
>Yes, documentation on the [:if ... :] syntax is still lagging. Here's
>a start:
>
>The [:if ...:] syntax allows portions of the markup text
>to be conditionally processed (up to the next [:if:]) depending on
>administrator-defined conditions. In 2.0.devel13 the only defined
>condition is "false" (which causes the markup text to be ignored,
>like a comment), but the admin can define other conditions in the
>$Conditions array.
>
>The generic form of the [:if:] directive is
>
> [:if cond param:]
>
>where "cond" names a condition to be tested from the $Conditions array,
>and "param" is a parameter or other argument held in $condparm in the
>test. For example, the following (in config.php) adds
>[:if group GroupName:] as a markup:
>
> $Conditions['group'] = "FmtPageName('\$Group',\$pagename)==\$condparm";
>
>One could then use the following markup:
>
> [:if group PmWiki:] This text only appears in the PmWiki group [:if:]
>
>The negated form of [:if:] is automatically handled as well, thus:
>
> [:if ! group PmWiki:] This text appears everywhere *but* PmWiki [:if:]
>
>Any [:if:] automatically terminates the previous one, thus markup can
>be easily cased:
>
> [:if group PmWiki:] Do this in PmWiki group
> [:if group Main:] Do something else for Main
> [:if:] This happens in all groups
>
>All that remains now is to come up with a good set of $Conditions.
>Testing for group membership is a good one, we might also want to
>create something for generic pagename pattern matches
>
> [:if match ^PmWiki\. :] Only appears in the PmWikiGroup
> [:if match RecentChanges$ :] Everywhere except RecentChanges pages
> [:if ! match ^(Main|PmWiki)\. :] All groups except Main and PmWiki
>
>$Conditions could also be conditional on other items; e.g., date or time,
>day of week, etc.
>
> > Is there already (or is it planned) a script for complete site-conversion
> > we could used after testing, so there's no need to run two wiki.d-dirs ?
>
>It's planned -- just haven't written/published it yet.
>
>Pm
>
>P.S.: Here's a (untested) attempt at the "match" condition
>suggested above:
>
> $Condition['match'] = "preg_match('!'.\$condparm.'!',\$pagename)";
>
>Pm
More information about the pmwiki-users
mailing list