[pmwiki] Re: [Pmwiki-users] Question to new page format variables

Bernhard.Weichel at t-online.de Bernhard.Weichel at t-online.de
Sat Jun 14 11:14:35 CDT 2003


Patrick R. Michaud wrote:
it doesn't matter, why do we need PrintWikiPage?
>
> Well, I had never really intended for people to call PrintFmt directly
> (although I certainly don't exclude the possibility).  For example,
> instead of doing
>
>      <?php PrintFmt($pagename, "function:PrintGeneralMenu"); ?>
>
> I would've written
>
>      <?php PrintGeneralMenu($pagename); ?>

oops, PrintFmt is really great. It provides all flexibility to
customization.
For my style of page, I don't like the "sandwiching" of many variables. So
I created one PHP file which does the entire layout. This PHP file has
several
PrintFmt  calls, most of them with a list to support fallbacks.

Unless there is a serious performance drawback, i will stick with PrintFmt.


>
> using PHP's built-in function calling syntax.  Similarly, instead of
>
>      <?php PrintFmt($pagename, "file:somefile.php"); ?>
>
> I would expect
>
>      <?php include("somefile.php"); ?>
>

I do

<?php PrintFmt($pagename, "file:\$Group.menu.php $Group.menu.\$lang.php
default.menu.php somefile.php"); ?>

this is a great feature.

> However, there is no PHP equivalent function for displaying a wiki
> page,
> so I wrote one and called it PrintWikiPage(), thinking that would be
> easier for most people than calling PrintFmt().

for me it is not easier. The Page Layout variables support "file",
"function" "wiki".

By providing the searchlist, PrintFmt is rally great. And it is even better
to maintain and to change.

I even would like to substitute

     PrintText($pagename, "[[PmWiki:PmWiki [[\$Version]]]]")

by

     PrintFmt($pagename, "text:[[PmWiki:PmWiki [[\$Version]]]]")

By the way: shouldn't

    FmtPageName("\$action", $pagename)

be also swapped to

FmtPageName($pagename, "\$action");

    to be the similar to PrintFmt as you did with StartHTML.

>
>> 2. If I use PrintFmt($pagename, "wiki:\$Group.Menu default.Menu")
>>    Is there a way to find out which page is actually printed. This is
>> important
>>    since I want to specify e.g. a general link to "Edit Menu" within
>> the function
>>    PrintGeneralMenu.
>
> At present, no.  I could modify PrintWikiPage or PrintText to set a
> global variable containing the name of the page that is actually being
> printed (if so, what should it be called)?
>

Could we make a function like

LookupFmt("wiki:Main.Homepage your.page his.page")
LookupFmt("file:local/foo/bar foo/bar")

which returns the first alternative found?

--bernhard





More information about the pmwiki-users mailing list