[pmwiki-users] How to retrieve the first author of a page?
hans.bracker at googlemail.com
Thu Aug 10 03:21:38 CDT 2006
On 09/08/06, Alejandro Pÿffffe9rez <aperezzz at yahoo.com> wrote:
> Consider what I am doing like an extension to ryevote results mixed with the newpagebox. I've managed to add links to a page at the same time you create them (just what I asked there a few days ago). And it creates a poll in the new page too. I know how to display the poll results in the previous page, right next to the link. But I'd also like the ryevote results markup to have access to the history of the new page (name stored in a variable) so I can add a "page created by" text. Is that possible?
If you use a template page for your new page creation, you could add
to the template page:
page created by ~~~
The ~~~ will be replaced with the current author, so for a new page it
will be the author of the new page.
One problem is that pmwiki will replace ~~~ on saving the page with
the author link, so when you modify your template page the ~~~ will
not stick but be replaced with the author link too. I got it working
by opening the page file in wiki.d of the template page in a text
editor and inserting ~~~ manually and saving the file, so preserving
the ~~~ and circumventing the automatic replace-on-save function
(called ROSPatterns) which acts otherwise on ~~~.
But better would be to disable the ROS for the template page.
For this you can add to config.php:
$page = PageVar($pagename, '$FullName');
$ROSPatterns['/(?<!~)~~~(?!~)/'] = '~~~';
Just replace Templates.NewPageTemplate with your actual template name.
This will preserve the ~~~ for the template page.
More information about the pmwiki-users