[pmwiki-users] creating pages
Patrick R. Michaud
pmichaud at pobox.com
Wed Feb 23 21:14:28 CST 2005
On Wed, Feb 23, 2005 at 08:30:38PM +0100, Knut Alboldt wrote:
> Patrick R. Michaud schrieb:
> >On Wed, Feb 23, 2005 at 11:40:06AM +0100, Knut Alboldt wrote:
> >>Is there a possibility to create a page by clicking a link, e.g.
> >>[[somegroup.somenewpage?action=newpage]]
> >>When clicking on that link I want to create a new page in wiki without
> >>any further user interaction (e.g. edit-screen)
> It's just an idea to collect a snapshot of data from outside wiki (using
> php-code in the markup) at a certain time the user specifies (by
> clicking the link, e.g. apache access log display, calendar lists, data
> dumps etc. In a further step I'd like to use this by an own cron-driven
> agent to trigger that via http-request.
Are you interested in saving the snapshot of the data at all? If not,
it sounds like what you want is your own HandleXYZ() function, instead
of trying to "save/edit" a wiki page.
The basics for creating a custom ?action=xyz are:
1. Write a function (normally called HandleXyz()) to be called.
The standard template for such functions is:
function HandleXyz($pagename) {
global $HandleXyzFmt, $PageStartFmt, $PageEndFmt;
SDV($HandleXyzFmt,
array(&$PageStartFmt, 'function:my_output_fn', &$PageEndFmt));
PrintFmt($pagename, $HandleXyzFmt);
}
When called, this function will output the standard page template
(everything before <!--PageText-->), the output from my_output_fn,
then the rest of the page template. It allows the output to be
customized in $HandleXyzFmt.
2. Link the function to ?action=xyz with the following:
$HandleActions['xyz'] = 'HandleXyz';
3. Write my_output_fn() to do whatever custom output you want to
have performed.
If you really did intend that ?action=newpage would actually save new
content into a page, let me know and I'll give you the sequence for
that. :-)
Pm
More information about the pmwiki-users
mailing list