[pmwiki-users] Prepend text string to wiki file

Patrick R. Michaud pmichaud at pobox.com
Thu Sep 6 14:00:57 CDT 2007


On Thu, Sep 06, 2007 at 02:42:23PM -0400, Josh Miller wrote:
> No, I'm looking for the file name in the wiki.d directory.

Actually, PmWiki never uses "filenames" -- it always uses
page names.  So, in short answer to your question -- no, there's
not a "filename" variable in PmWiki... but you don't really
need or want the _filename_, because PmWiki itself never uses
it for editing/includes/whatever.

> To explain it, we have a staff page with snippets of each staff member:
> 
> Index.php?n=Staff.HomePage
> (:include Staff.Jim:)
> (:include Staff.Bob:)
> (:include Staff.Cal:)
> Etc.
> 
> Now when I view the Staff.HomePage page, if I click on an edit link like
> {$FullName}?action=edit then it edits the Staff.HomePage page not, the
> Staff.Bob page, the actual page I need to edit.

Are you using PmWiki 2.2.0-beta?  If so, then putting 
{$FullName}?action=edit at the beginning of each Staff page will
do exactly what you expect.  (If you're using 2.1.x, then {$FullName}
refers to the page containing the includes, which isn't what you
want.)

> The idea was to prepend each page with a link (when logged in) so that
> to the right of the page there would be 3 links:
> Edit Staff.Jim
> Edit Staff.Bob
> Edit Staff.Cal
> 
> So now when I view the Staff page, I can "skip" over to Staff.Bob and
> edit his page.

You may be able to do this much more easily using pagelists and/or
trails.  For example, on your Staff.HomePage, you could
write:

  (:pagelist group=Staff list=normal fmt=#incedit:)

  (:if false:)
  [[#incedit]]
  %rfloat% [[ {=$FullName}?action=edit | edit {=$FullName} ]]
  !! {=$FullName}  
  (:include {=$FullName}:)
  [[#inceditend]]

This will display a list of all pages in the Staff group
with edit links for each.  See, for example, 
http://www.pmwiki.org/wiki/Test/ProfileList, where I've used
pagelist to display the initial contents of the first 50 profiles
pages on pmwiki.org, with edit links to each.

Pm

> -----Original Message-----
> From: Patrick R. Michaud [mailto:pmichaud at pobox.com] 
> Sent: Thursday, September 06, 2007 1:56 PM
> To: Josh Miller
> Cc: pmwiki-users at pmichaud.com
> Subject: Re: [pmwiki-users] Prepend text string to wiki file
> 
> On Thu, Sep 06, 2007 at 10:31:51AM -0400, Josh Miller wrote:
> > 
> > Is there a variable for the filename in the Wiki.d directory?
> 
> Do you mean the page name?  If so, then {$FullName} is what you're
> looking for.
> 
> > So that If that variable were $frenchfries for example, I could use 
> > the following in the template:
> > %right% [[{$frenchfries}?action=edit | Edit]]
> 
> If you're wanting to edit the page that is currently being displayed (as
> given by the name in the address bar), then use {*$FullName}?action=edit
> .  To edit the page that is being included, then be sure you're using
> 2.2.0-beta and use {$FullName}?action=edit .
> 
> Pm
> 
> 
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users



More information about the pmwiki-users mailing list