[pmwiki-users] How do I get $EditRedirectFmt also return Page Text Variables?

Dave smartucus86 at yahoo.com
Fri Apr 15 18:54:36 CDT 2011


I have created a page that acts as a template using multiple (:include :) for each of various pages.  
The idea is that I have multiple companies A, B & C and each has Products, Support and Contacts
 
I use the PMWiki sidemenu to embed into the link url the specific name of the company.  
Something like: Comp/0?CompSName=RMS
 
My template page "0" can then include:
     RMSProducts, RMSSupport and RMSContacts or 
     XYZProducts, XYZSupport and XYZContacts
as appropriate.
 
Each include automatically has an EDIT button which will allow editing of ONLY that subcategory (XYZProducts or RMSContacts, as appropriate).  This ensures users cannot modify the master template and only edit specific content.
 
All works well, until...  I save after the edit.
 
As you know a SAVE takes you back to the page you were editing.  Since this is only subcontent, I want to be returned to my template BUT in order to return to my template and populate the content I need to somehow preserve either a page text variable or the url variable.  To use $EditRedirectFmt I need to preserve my paramenter to encode it on the redirect url.
 
I can preserve the parameters in the url all the way to my custom EditForm which looks like so...
     Comp.0RMS-Product?action=edit&CompSName=RMS
 
Now comes the place where I pull out my hair.
 
I cannot figure out how to create a global variable that is preserved nor can I figure out how to preserve the parameters in my url when I redirect(either one would be sufficient).
 
I have tried everything I can think of and there is one perplexing problem.  It's the fact that a global variable seems unaffected.  Here is a sample of what I am doing with output noted.
 
     This line is in my EditForm   (:CompSName: RMS :)
 
     and these are in my config.php    
          SDV($CompSName, 0);
          Markup('CompSName','<{$var}','/\\(:CompSName: (\\w+) :\\)/e','CSName("$1")');
     
          function CSName ($val) {
             global $CompSName;
             $CompSName = $val;
             echo " #A- ".$CompSName;                 //output = RMS
          }
     
          echo " #B-".$CompSName;                     //output = 0
 
Why isn't my global variable preserved?  It is set correctly in the function but outside the function it is set to 0, either as if it's never been changed or as if SDV function is changing it back to 0. (When I remove the SDV function it still not not function).
 
Is there a way to get a value back from the EditForm to the redirected page?
 
Sorry if this is long or confusing.  I tried to simplify as much as possible.
 
Dave
 
PS - Using PMWiki 2.2.19 runing with PMWiki PHP server.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20110415/0c80aab2/attachment.html>


More information about the pmwiki-users mailing list