[pmwiki-users] Page Adding?? What is the sanctioned method?
Crisses
crisses at kinhost.org
Tue Oct 3 11:31:38 CDT 2006
Ok -- I'm having trouble. I'm trying to create multiple pages from a
single form in PmWiki. It worked yesterday, except the Category
pages weren't created correctly. Now it's more broken.
I added
$AutoCreate['/^Category\\./'] = array('ctime' => $Now);
to my config.php. First at the top. Then at the bottom. Then
before the WritePage directive (see "save page data" in
"flowchart"). Where should this directive be?
Here's the flowchart:
Form on wikipage --> user enters data --> user submits ($_POST) form.
custom HandleActions grabs $_POST data sends it through custom function
save original $_POST data
loop: reset $_POST variables to what I want -> $_POST['text'] is
essentially set to a bunch of [[!PageName]] category links -> save
page data
restore original $_POST data
return control to PmWiki
I'm using
WritePage($pagename, $_POST);
I'm creating:
$_POST['text'] = [[!Author-SteinbeckJohn]] [[!Title-OfMiceAndMen]] [[!
Year-1937]] [[!Period-20thCentury]] [[!Type-Fiction]] [[!Publisher-
PenguinBooks]]
Two problems:
1) this is only saving the $_POST['text'] data to the page if it's
updated the 2nd time around -- if the page already exists -- not upon
initial page creation. And the page IS being created the first time
around.
2) this is not creating the Category pages even when it succeeds in
putting the $_POST['text'] into the page body.
The only thing that changed between yesterday & today is that I
upgraded my pmwiki installation to beta-11 and removed an extra step
where I had:
if (! PageExists('Category.PageName') ) {
WritePage("Category.PageName", "");
}
This last version under beta10 actually DID create the Category pages
but they weren't behaving correctly. This is all I removed from my
hack that was working -- all but the Category pages working properly
-- yesterday.
Is there a better, or "more right" way to loop and create multiple
pages from PmWiki? What functions or methods? What are the
parameters they require? Is this documented in either pmwiki.php
somewhere or on the site? Is WritePage the correct function to use?
Also: Does the AutoCreate work with the abbreviated Category
markup? [[!Page]]
Crisses
More information about the pmwiki-users
mailing list