[pmwiki-users] FASTData change request

Crisses crisses at kinhost.org
Wed Sep 27 09:00:08 CDT 2006

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.

function Simile () {
	global $pagename, $DataKey, $ScriptUrl, $data, $MessagesFmt;

	// save data that will be changed
	$hold_pagename = $pagename;
	// split up data from simile on form
	$similes = explode("\n", $_POST['Simile']);
	foreach ($similes as $value) {
		if ((trim($value)) == "") continue;
		$simile = explode(" ", $value);
		$firstfour="$simile[0] $simile[1] $simile[2] $simile[3]";
		// create new page title(s)
		// Simile/BookTitle:AuthorName:FirstFourWordsOf
		$newpage = $_POST['Work'] . ":" . $_POST['Author'] . ":" . $firstfour;
		$pagename = MakePageName("Simile.HomePage", $newpage);
		// add new pages to wiki
	// reset data that changed

	$pagename = $hold_pagename;
$HandleActions['simile'] = 'Simile';

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.

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.

your definition:
function Data() {
becomes your definition:
function Data($flag=0) {
// check flag & if set, stop function execution; return control to  
the calling program
if ($flag) { break; }

//this is the end of the processing, so now you can refresh the page,  
and return the user to the browser
// this will only execute if $flag=0 or $flag is unset by the calling  
// 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


this change won't break anything already running using the Data  
function, but will allow more wrappers to use it. :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20060927/1175cd90/attachment.html 

More information about the pmwiki-users mailing list