<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">I updated my version of data.php:<DIV><BR class="khtml-block-placeholder"></DIV><DIV>//XES -added flag to break before resetting page</DIV><DIV>function Data($flag=0) {</DIV><DIV>...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>// xes - added flag to stop running....</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>$MessagesFmt[] = "<h5 class='wikimessage'>$[$m]</h5>";</DIV><DIV>if ($flag) return;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>if ($_POST[nextpage] == $pagename)<SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>HandleBrowse($pagename);</DIV><DIV> <SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>else Redirect(FmtPageName($_POST[nextpage], $pagename));</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>}</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>That part is fine.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I changed my config.php part of the hack:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>function Simile () {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>global $pagename, $DataKey, $ScriptUrl, $data, $MessagesFmt;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>// save data that will be changed</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>$hold_pagename = $pagename;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>// split up data from simile on form</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>$similes = explode("\n", $_POST['Simile']);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>foreach ($similes as $value) {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>if ((trim($value)) == "") continue;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$simile = explode(" ", $value);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$firstfour="$simile[0] $simile[1] $simile[2] $simile[3]";</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>// create new page title(s)</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>// Simile/BookTitle:AuthorName:FirstFourWordsOf</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$newpage = $_POST['Work'] . ":" . $_POST['Author'] . ":" . $firstfour;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$pagename = MakePageName("Simile.HomePage", $newpage);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$_POST['makepage'] = $pagename;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>// add new pages to wiki</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>Data(1);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>}</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>// reset data that changed</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>$pagename = $hold_pagename;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>HandleBrowse($pagename);</DIV><DIV>}</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>And it adds the pages I want, and returns the user to the original page. Not perfect, but it's working so far.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>But the AllRecentChanges and RecentChanges don't have the new pages. Is that coming soon? :)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The relevant FASTData code I'm calling is:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>if (substr($field, 0, 8) == "makepage") {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>$contents = "";</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>$s = explode("|", $_POST[$field]);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>if (isset($s[1])) $contents = GetTemplate("page",$s[1]);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>if (! PageExists($s[0])) {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>$page['text'] = $contents;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>$page['title'] = $_POST[title];</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>Lock(2);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>WritePage($s[0], $page);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>Lock(0);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN> PageIndexUpdate($s[0]);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>$m .= "Page $s[0] created.";</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                                </SPAN>}</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>else "Page $s[0] already exists. Could not be created";</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                        </SPAN>}</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I think I remember PM saying that he was changing a function to replace WritePage so that everything got updated properly across the wiki, but if that's not implemented yet, this might do.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><DIV><P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">Crisses</FONT></P> </DIV><BR><DIV><DIV>On Sep 27, 2006, at 10:00 AM, Crisses wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV>I added a wrapper to config.php that parasites off of your Data function so that I (theoretically) wouldn't have to hack your script. </DIV><DIV><BR class="Apple-interchange-newline"><BR><DIV>function Simile () {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>global $pagename, $DataKey, $ScriptUrl, $data, $MessagesFmt;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>// save data that will be changed</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>$hold_pagename = $pagename;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>// split up data from simile on form</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>$similes = explode("\n", $_POST['Simile']);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>foreach ($similes as $value) {</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>if ((trim($value)) == "") continue;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$simile = explode(" ", $value);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$firstfour="$simile[0] $simile[1] $simile[2] $simile[3]";</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>// create new page title(s)</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>// Simile/BookTitle:AuthorName:FirstFourWordsOf</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$newpage = $_POST['Work'] . ":" . $_POST['Author'] . ":" . $firstfour;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>$pagename = MakePageName("Simile.HomePage", $newpage);</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>// add new pages to wiki</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN>Data();</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>}</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>// reset data that changed</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>$pagename = $hold_pagename;</DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN></DIV><DIV>}</DIV><DIV>$HandleActions['simile'] = 'Simile';</DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>As it stands it only adds the first page sent to it. Everything up to the call to Data works just fine -- it iterates through, creates new page names, etc.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I think I need a flag for Data() that will stop it from ending the script execution and return control to the wrapper script. That allows Data to be a usable hook for similar recipes to mine. i.e. </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>your definition:</DIV><DIV>function Data() {</DIV><DIV>...</DIV><DIV>}</DIV><DIV>becomes your definition:</DIV><DIV>function Data($flag=0) {</DIV><DIV>...</DIV><DIV>// check flag & if set, stop function execution; return control to the calling program</DIV><DIV>if ($flag) { break; }</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>//this is the end of the processing, so now you can refresh the page, and return the user to the browser</DIV><DIV>// this will only execute if $flag=0 or $flag is unset by the calling program</DIV><DIV>// i.e. this is what you're doing now, after the page is created, but before you refresh the page since that makes your script stop anything else from running</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>}</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>this change won't break anything already running using the Data function, but will allow more wrappers to use it. :)</DIV><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Comic Sans MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Comic Sans MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Comic Sans MS; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV><BR class="khtml-block-placeholder"></DIV></SPAN></SPAN></SPAN><DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT face="Comic Sans MS" size="3" style="font: 12.0px Comic Sans MS">Crisses</FONT></DIV></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">pmwiki-users mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:pmwiki-users@pmichaud.com">pmwiki-users@pmichaud.com</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://www.pmichaud.com/mailman/listinfo/pmwiki-users">http://www.pmichaud.com/mailman/listinfo/pmwiki-users</A></DIV> </BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>