Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

Fox-Comments

Back to Fox

Please leave latest comment or question at the top of this section:

In fox.php the page number text used in multi-page output is hardcoded as 'Page' in two places. This means that one cannot translate fox-output to other languages using the normal $[Page] convention without changing the code. Could this be fixed for consistency? 18.06.2008, JHJ

I cannot find it. Can you give me version and line numbers, or in which error message? Thanks! - HansB June 18, 2008, at 12:02 PM

Sorry, in foxforum.php actually, lines 160 and 224. version 2008-03-30. - 19.8.2008, JHJ

okay, thanks! I updated foxforum.php to use $[Page] for internationalisations. - HansB June 19, 2008, at 10:37 AM


Hans, I am trying to create a search form for a (flat) database (a bib file using bibtexref, but this may not be important). I hand the parameter to the function as a page text variable. Since these are updated only after the page is written I have to hit the Submit button twice, which works but is not nice. I suppose I am doing this all wrong but couldn't think of something else. My problem would go away if ptvs were updated first. Is there a way to do this? Here is my code:

 (:fox bib ptvtarget=Test/Test ptvfields=myyear:)
 (:input text myyear {$:myyear} size=4:)
 (:input submit post "Submit":)
 (:foxend bib:)

bibtexquery:[all.bib][$this->get('YEAR') == ''][!$this->get('PUBDATE')][5]

bibtexquery is a function provided by the bibtexref recipe.

Thanks in advance for any help.

Rudi, May 17, 2008

Try adding redirect=1 to the (:fox ....:) markup, which will refresh the PTV in the page after posting. HansB

This works. Thank you so much!


Hans, I never did get my version of Fox ToDo all the way where I want it. I haven't really kept up with all your updates, but I was wondering whether you can tell me if there is now a way to accomplish the last step: deleting and posting with a single submit. Here is what I have so far:

  1. Post new todo items to a designated area of the page (for pending items)
  2. Select multiple pending todo items (with a checkbox) and post those to another designated area (for completed items)

What I still want to do is to delete the selected pending items at the same time that they are posted. If that is not possible, can you see another way to approach this so that I don't have to do two steps to move an item from one area to another? Here is the markup I am using right now:

!To Do

(:fox todo:)
(:foxtemplate (:input checkbox todocb[] '{$$todo}':) {$$todo} {[foxdelline]} [[<<]]:)
* (:input text todo size=65%:)(:input submit post Add:)
(:foxend todo:)

!!Pending Tasks

(:fox done:)
(:foxtemplate *{$$todocb[]}:)
(:foxprepend todo:)

(:input submit post "Completed":)
(:foxend done:)

!!Completed Tasks

(:foxprepend done:) 

Pico May 17, 2008, at 01:39 PM

Alternative: I really should be just using PTVs with a replace to toggle values between pending/complete, on/off, etc., and then doing some type of a list (pagelist based on an array PTVs in the current page filtered by the value (pending/complete, or on/off).

Alternative Recipe: Here is some inspired (hopefully not unwelcome) musing on a recipe I have been imagining for a long time: Create another type of PTV definition that holds a binary logic value (on/off, or true/false) where you could iterate (an array?) to generate a listing of all true, or false, values. The markup for that recipe could use something really minimal, such as a pair of brackets, "[]", at the start of a line, like list markup, to generate input check boxes and PTV containing a binary value. The names of those binary PTVs could be determined by text immediately following the "[]" markup. Or, following the list markup definition, the names of the PTV could be based on a value assigned in a list in which it appears. For example, the first order (parent) level of a list could identify a PTV array consisting of the values that appear in the next order (child) items of that list.

  • []VariableName
    • []First
    • []Second
    • []Third

So that an array variable called "VarableName[]" could have three pairs of values (logic, string) like this: False,First; False,Second; False,Third. A conditional testing for VariableName[]=False would return all three values, or pairs. The list could be hidden in a conditional to define posted values that get posted after (or before) a given (parent) item level. Default values could be set by markup arguments in the parent item, or by a three character markup string, e.g. "[+] / [-]" or "[_] / [X]", like this:

  • []VariableName
    • [-]First
    • [+]Second
    • [+]Third

So that a conditional testing for VariableName[]=True would return only the last two items.

Pico May 17, 2008, at 06:43 PM

Pico. I have not answered because I have no clever ideas for this problem of moving a line of text. Of course Fox can do several steps in one go: insert a line somewhere, and overwrite the original. Problem is how to identify it. Foxdelete works because it just replaces the line it is in with nothing. Some sort of foxmove link would be nice, but i don't know yet how to make the code for this. HansB May 19, 2008, at 06:26 AM


Hi, I'm getting this when trying to use ptvfields=something

Fatal error: [] operator not supported for strings in /home/....../cookbook/fox.php on line 1243

what have I messed up now?

thanks,
Taavi

Perhaps you are using illegal ptv names? If not I need to know more details about the form and the ptvs. HansB


table from fox input

Hi, I'm trying to give input to a table, where the headings are fixed and the form is placed in the bottom row. The submit function is then supposed to create a new row between the form and the header, including an edit and delete link. I though I had set up something that could work, but apparently I have done someting wrong. The template looks roughly like this:

 #foxbegin#
 (:cellnr:){$$number}
 (:cell:){$$name}
 (:cell:){$$date}
 (:cell:)({[foxedit form=Site.FoxTemplates#unitlist]})
 (:cell:){[foxdelrange ]}
 #foxend#

...and the form is placed inside the same number of coloumns with (:fox list put=aboveform template=(as above):) placed after the heading row. Ideally, the {$$number} should also be replaced by 1,2,3,etc and the total number should be a ptv. Is there an easy way I could make this work? Thanks, MikeG? May 12, 2008, at 17:22 PM

Mike, you don't say what exactly is not working. Note that with your template you need to set in config.php $EnablePostDirectives = true; since the advanced table markup consists of directives (syntax (:....:) ). The total number of rows can be displayed with page variable {$FoxPostCount}. It counts the occurences of #foxbegin#. HansB May 13, 2008, at 04:20 AM Correction: you don't need to set $EnablePostDirectives = true; in order to post markup directives which are part of the tenmplate! You only need it to allow users to post directives as part of their input. Sorry about the wrong advise before! - HansB May 13, 2008, at 05:00 PM

To add a row number automatically:

  • Add a PTV as a counter to the page: (:RowNumber: 0:)
  • Add to the (:fox ... :) markup: ptvfields=RowNumber ptvtarget={$FullName}
  • Add to the fox form: (:input hidden RowNumber '{$$(add {$:RowNumber} 1)}':) which updates the PTV with an increased number (you need to install Cookbook:MarkupExprPlus for this too)
  • Change the form number field to (:input hidden number {$$RowNumber}:) so th enew number is automatically used in the row (via the template).

I have set EnablePostDirectives, but when I submit, there is a processing period, but no content is added to the page. The form is placed like this:

 (:cell:)"last cell of heading"
 (:fox list put=aboveform template=(as above):)
 (:cellnr:)(:input text number size=5:)
 (:cell:)(:input text name size=25:)
 (:cell:)(:input select date ...:)
 (:cell colspan=2:)(:input submit post Add:)
 (:foxend list:)
 (:tableend:)
 MikeG? May 13, 2008, at 04:38 AM

Perhaps page permissions are not set correctly? Add a (:foxmessages:) markup to see any error messages. Fox should be able to post to the current page, but adding target={$FullName} won't do any harm. - HansB

Thanks a lot for your help. Got most of this working now, apart from the row numbers. When I add the first entry, I get RowNumber=1, but if I try to add a second entry the number stays the same. Unless I leave the page or reload, in which case it works all right. Reload also adds a new entry identical to the last one. How can this be avoided? MikeG?

reload should never add a new entry!
Here is the form I used for testing:

(:foxmessages:) 
(:table border=1:)
(:fox frm put=aboveform template=#tablerow ptvfields=number ptvtarget={$FullName}:)
(:input hidden number '{$$(inc {$:number})}':) 
(:cellnr:)
(:cell:)(:input text name:)
(:cell:)(:input text date '{$Now}':)
(:cell:)(:input submit post 'Add Row':)
(:foxend frm:)
(:tableend:)

(:number: 0:) 
last row number = {$:number}

(:if false:)
[[#tablerow]]
#foxbegin#
(:cellnr:){$$number}
(:cell:){$$name}
(:cell:){$$date}
(:cell:)({[foxedit form=Site.FoxTemplates#unitlist]})
(:cell:){[foxdelrange]}
#foxend#
[[#tablerowend]]
(:ifend:)

In config.php I added a definition for markup expression {(inc ...)}, which increases a number by one.

$MarkupExpr['inc'] = 'MxInc($args[0])';
function MxInc ($arg) {
	if(!is_numeric($arg)) return $arg;
	return $arg + 1;	
}	

I might add this in future to fox.php for conveniance. But using {(add ... 1)} from MarkupExprPlus is working just as well. The form template is on the same page, which is not ideal, but fine for the test. I have no idea how your foxedit #unitlist template works though.

The form adds a new row with the increased number. Note that I use here 'number' as input field name, which value is added by template {$$number}, and 'number' as a PTV name, which value gets used in the form with {$:number}. I called this RowNumber before. The last number shown with {$:number} will be one less the actual value, until the page is refreshed. One could avouid this by adding redirect=1 to the (:fox ...:) markup. - HansB May 13, 2008, at 10:27 AM

The {(add ... 1)} function seems to be working fine. I added redirect=1 and now the numbers update without any problems. Thanks for all the help, MikeG?.

So what stopped it posting in the first place? - HansB

Not sure. Could it have been the missing $EnablePostDirectives = true;? I was wrong advising that this is necessary. It is not. Directive markup in the template will be posted in any case just fine. HansB

Will start inserting (:foxmessages:) markup in my forms :).
Note that by using redirect= Fox cannot display any message via (:foxmessages:). For debugging turn off the redirect parameter, so you stay on the same page and the page is not reloaded and messages wiped. HansB

Also not sure how the edit template will look as I haven't put that together yet, but each line in the table produces a set of pvt's (also with incremental numbers) which I then plan to base the edit form on. MikeG?

Good, that should be not too difficult then. Just add section={$$number} to the foxedit markup in the template, to give you a hook for each PTV in the PTV edit form you need to build. Use edit form fields like (:input text name=$:date{$EditSection} :). FoxEdit will pass the row number as {$EditSection} page variable, and 'date23' for instance will be the PTV name for the date in row 23. On FoxEdit about "Adding edit links to FoxForum posts" you find a template example working in this way. - HansB

Decided to use {$FoxPostCount} as the ptv, counting the number of entries. However, I wanted to have a comment form on the page as well, and the way it works now, comments are included in the same page and therefore also counted. Is there a way to exclude them from the {$FoxPostCount} calculation, or to have a separate page for discussion, with the form and comments included on the main page? How would this page be created? -MikeG?.

One problem using FoxPostCount for generating post numbers is, that if you use foxedelete as well, posts can be deleted and the next new post will get a number which may be used already. - To post comments to a different page use for instance a target parameter like target={$FullName}-Comments in the fox markup. - HansB May 15, 2008, at 05:59 AM

So the form creates a separate comment page, displayed on the main page by (:include {$FullName}-Comments:). However, the {[foxdelrange]}-link doesn't work when clicked from the main page, only on the {$FullName}-Comments page. I see you have discussed something like this further down on the page, but it's still not clear to me how to fix it... MikeG?

What happens when you click a delete link from the main page? Do you have a foxmessage markup to see error messages? - HansB

(:foxmessages:) displays "ERROR: Delete action was unsuccessful!" The problem is the deletelink that is created by the template for the comment page. When read through (:include ...:), it links to {FullName} instead of {$FullName}-Comments. MikeG?

In config.php you need to have $EnableRelativePageVars = 1; - HansB


javascript formcheck not working (i want to require an authorname)?

hi - formcheck doesn't seem to work for me with the following fox form:

    (:fox cbox put=bottom template=Site.FoxCommentTemplate target={*$FullName} 
      formcheck=author redirect={*$Group}/MainPage cancelredirect={*$Group}/MainPage :)

... and later on, comes the author box:

    (:input text author value='{$Author}' :)

currently, neither formcheck=author nor formcheck=1 causes fox on my site to ask for an authorname, and any user can still submit a comment w/o entering one.
??
thanks! overtones99? May 07, 2008, at 12:23 PM

Fixed now. Note formcheck=1 is not valid. You need to specify form field names, separated by commas. If you don't want this simple javascript check, but proper php validation, with custom messages, use markupo (:foxcheck fieldname ...:) (See Fox#foxcheck HansB May 07, 2008, at 04:08 PM

thanks. both seem to work alright now - however there seems to be a problem with foxcheck when checking for captcha:

       (:foxcheck name=author,comment,captcha msg='required field' :)

and then later...

       (:input captcha class=inputtext:)

when checking for captcha, it won't post the comment even if the captcha field is filled out correctly...
??
overtones99? May 07, 2008, at 08:16 PM

This is because (:input captcha class=inputtext:) is not a normal input markup. In particular the name of the captcha text field is not 'captcha', but normally 'response' (it can be redefined). So (:foxcheck response ... :) should do the trick. If you want to name the field 'captcha', add to config.php: $CaptchaName = 'captcha'; - HansB May 08, 2008, at 02:21 AM

that did it. thanks again for the umpteenth time! overtones99? May 08, 2008, at 03:06 AM


#anchors not working in redirect= field...

hi. i'm trying to get my FoxCommentBox to redirect to the comment section at the bottom of a page. i'm setting redirect=MyGroup/Index#comments, and the anchor seems not to be appended to the path.

  (:fox cbox put=bottom template=Site.FoxCommentTemplateWhite target=Cookbook.Fox-Comments 
       redirect=MyGroup/Index#comments cancelredirect=MyGroup/Index#comments:)

is this working on your end? i'm currently running the latest version of Fox (5/1/08)
thanks. overtones99? May 01, 2008, at 12:53 PM

To redirect to an anchor position one needs to supply a full url using the standard url syntax, not a short url. So use redirect={$ScriptUrl}?n=Group.PageName#anchor . cancelredirect does not work with anchors or full urls, but only with Group.PageName. - HansB May 01, 2008, at 03:20 PM

great. indeed it works. thanks. only issue now is purely aesthetic - the address for the page looks like http://blah.com/?n=Blah.Index#anchor even though my pages are set to do clean URLs. but it doesn't bother me, as long as it works.
thanks!
adam, overtones99? May 01, 2008, at 04:37 PM

from Hans: Please see latest fox update, which improves the redirect greatly.
Redirect to an anchor is possible now, for instance like

       redirect=Group.Page#anchor

- HansB


fox delete page action...

hi. i'm having trouble getting a 'delete page' action to work (as described on FoxPageManagement).

i created a page on my main site (let's called it GroupOne/Blah), and as a test i am trying to delete it with the page action provided in the fox documentation under "One click page delete action link" - the only difference is i changed the permissions to 'admin':

   if (CondAuth($pagename,'admin')) {
       $EnableFoxUrlInput = 'true';
       $FoxPagePermissions['*.*'] = 'all';
   }

and in SiteAdmin.FoxConfig, i have:
*.*: add,delete

 GroupOne.*: add,delete

(if this is even necessary??)

when i click the delete link, i'm redirected to the main group page, GroupOne/Index (as expected), however, if i now go and type in GroupOne/Blah, it comes up just as bright and alive as it was before, as it wasn't deleted. (this happens if i change the auth to plain 'edit' as well.)

any idea what i might be doing wrong?

i have the following fox files installed:
foxnotify, foxdelete, fox

thanks, adam
overtones99? April 26, 2008, at 02:00 AM

Add &target={*$FullName} to the link url parameters. I updated the example accordingly on FoxPageManagement. - HansB

hrm - seems like that would do it, but it still doesn't delete. it now redirects correctly, however... i wonder if it works on your end? overtones99? April 27, 2008, at 01:08 AM

update: having now deleted *.*: add,delete from my SiteAdmin.FoxConfig, the delete-action now works like it should(!). i haven't tried it yet, but i'm presuming that putting *.*: all in there might have worked as well... thanks! overtones99? April 27, 2008, at 01:46 AM

Additional fox deletion problems

and in a similar area, i'm also unable to delete multiple pages using the Fox code from the bottom of FoxPageManagement. everytime i check off a page or two to delete, i get the msg, "PERMISSION DENIED to replace on JoeSchmo.JoeSchmo-Blah!"

any idea what i might be doing wrong?
i've currently got the following settings:

 $FoxNameFmt[] = '*.*';
 $FoxAuth = 'read';
 $EnablePostDirectives = true;
 $EnableFoxDeleteMsg = true;
 $FoxDeleteMsg = "Are you sure you want to delete this message?";
 $EnablePostCaptchaRequired = 1;

 if (CondAuth($pagename,'edit')) {
    $EnableFoxUrlInput = 'true';
    $FoxPagePermissions['*.*'] = 'all'; 
 }

and then all my fox files are loaded, as well as powertools.php (which i have loading after fox loads - is that a problem?)...

thanks again for all your help. overtones99? April 26, 2008, at 02:23 AM

This looks like a $FoxPagePermissions problem. I don't know why $FoxPagePermissions['*.*'] = 'all'; is not recognised. Try for testing without the condition. Also try a group specific variation. - HansB

thanks. i think i figured it out. in addition to my $FoxPagePermissions being set in config.php, on SiteAdmin.FoxConfig i also had *.*: add,delete listed on there... in calling both, it appears the FoxConfig page short-circuited it. now, with it missing from FoxConfig, it deletes absolutely perfectly... what a great little tool. thanks! overtones99? April 27, 2008, at 01:46 AM


Risk of Fox Inclusion in main distribution...

Hi - just wondering - how much risk is there in parts of Fox someday being included in the main distro of pmwiki? and if it ever is, do you think that the syntax would then change, i.e. all the (:foxwhatever's ...:) changing back to the originals? just wondering... overtones99? April 25, 2008, at 02:22 PM

I don't think this will happen. Pm created PmForm. This may still improve, but I don't think it will ever be expanded to post to multiple target pages or other special things Fox does. And Fox is far too complex to have the slightest chance of being absorbed in the PmWiki core. Even PmForm will not be added to the distribution I think. HansB


Lock/hide forms

Hi! I've been using Fox forms to update different sections of a reporting page, with bullet points and progress indicators. Is there a way, either on a specified date or by following a command link, to stop editing abilities and (1) export the headers and text to a new page, or (2) remove all input fields and forms from the page? Mike G? April 25, 2008, at 04:55 AM

There should be no need to have the form on the page itself. It could be on some template page and either be included via a (:include ...MyForm :) or called via a FoxEdit link, and you can disable these with conditional markup (for instance after a certain date). - HansB April 25, 2008, at 07:32 AM

Thanks. Have set up FoxEdit links for each section on the page. The date conditional doesn't help me as long as I can't set time. Could you give me another example of conditional markup that could serve this purpose? To use authgroup doesn't work as all users can read and edit.Mike G? April 25, 2008, at 10:25 AM

what condition do you really need, exactly? - HansB

I'm using ExportDOC to save the page in Word format upon completion. What I need is a button that can disable the edit links and then, with [[{$Name}?action=doc]], export the final document, in one or two operations. Mike G?

If foxedit links or other form elements or include markup isadded to the page by Fox via a template, then you can add foxdelete links as well, either with range markers as a foxdelete range link, or if it is a single line as a foxdelete line link. Foxdelete links need to be added via template, a later addition does not work, as Fox adds a range or line id key, which the foxdelete needs to delete just the right line or range.

Template for foxdelete link which deletes the range marked by the markers, including itself:

#foxbegin#
....
{[foxdeleterange ]}
.....
#foxend#

- HansB


Fox Permissions

Hi - i've been looking at the permissions examples on the Fox cookbook page, and am wondering - is there a way to set separate 'read','edit' and 'admin' fox permissions for pages on SiteAdmin.FoxConfig?? or is it only possible to do this in config.php (as shown in the example on the Fox cookbook page)? thanks, adam overtones99? April 24, 2008, at 09:16 PM

At present you cannot set $FoxAuth values in page FoxConfig. You can only set $FoxPagePermissions page pattern / values within FoxConfig. - HansB April 25, 2008, at 02:16 AM

thanks!

Custom Fox Delete Msg?

can one set the confirmation msg that pops up when $EnableFoxDeleteMsg is set to true? right now mine is blank, except for the URL basename...
thanks
overtones99? April 24, 2008, at 11:26 PM

$EnableFoxDeleteMsg = true; will enable the javascript delete confirmation. The default message is: "Please confirm: Do you want to delete this post?" Try setting $FoxDeleteMessage to the message you want. - HansB April 25, 2008, at 02:16 AM

i'm on a mac, and in both firefox & safari the only message that shows by default is: "The page at http://blah.com says:", and then nothing following it. adding $FoxDeleteMessage, doesn't work, but $FoxDeleteMsg DOES. thanks!! overtones99? April 25, 2008, at 02:12 PM


Input Value and Label

I want to make a simple form for progress report. (:input select stage 1 label="Assessed":) is the markup used, with 5 different stages to choose from. Is it possible to output both the stage number and the label as variables using Fox? Thanks, Mike G? April 23, 2008, at 02:19 AM

'label' is not directly available as an input value. So you may try something like this example test form:

(:fox frm foxaction=display:)
(:input select choice "1 Assessed" label="Assessed":)
(:input select choice "2 Tested" label="Tested":)
(:input select choice "3 Approved" label="Approved":)
(:input hidden stage "{$$(substr '{$$choice}' 0 1)}":)
(:input hidden type "{$$(substr '{$$choice}' 2)}":)
(:foxtemplate "{$$stage} {$$type}":)
(:input submit post Enter:)
(:foxend frm:)
(:foxdisplay frm:)

This uses {(substr .... )} markup expression to extract parts of an input value ('choice') (which combines both original value and label) and assigns it to a different input variable (hidden field name 'stage' and 'type'). Observe all the quote marks and $ signs carefully. HansB April 22, 2008, at 05:15 AM

Works! But I am using one form to generate the pages for each unit, and a second form in the template for status updates. So the second form works well in the template, but when the page is generated, the {(substr ...)} markup is processed, and disappears. How can I avoid this? -Mike G? July 04, 2008, at 04:28 PM

If you want to post form templates, without having the replacement variables evaluated, use $$$ instead of $$ for each {$$var}, i.e {$$$var}. I hope this works for {$$$(expression)} as well. If not, I have to do some work on this. - HansB April 23, 2008, at 02:31 AM


Conditional markup in fox form

Hi! I'm new to this and may not be doing things the easiest way always, but I am testing out the wiki as a project tool, and setting up a form for input of new registrations. The heading of each entry should contain "sector" "building" "floor number" and "door number", separated by a dash. Some entries don't have the door number, and should therefore just contain the other 3 variables. What I put in the form is this:

(:if equal {$$unitdoor} "":)
(:input hidden unit "{$$sector}{$$number}/{$$unitfloor}":)
(:else:)
(:input hidden unit "{$$sector}{$$number}/{$$unitfloor}/{$$unitdoor}":)
(:ifend:)

Still, {$$unit} exports with a dash at the end, regardless of whether {$$unitdoor} exists or not. There is hopefully a very simple solution to this, but try-and-fail is not helping me anymore.

Thanks! Mike G? April 19, 2008, at 12:30 AM

Such conditionals are evaluated by PmWiki when the page gets created, not when the form gets submitted. fox has no built-in method using conditionals in the markup. But it can be done with the help of MarkupExprPlus. Install this recipe and then construct a markup expression which gets evaluated when the form gets submitted. Usual markup expressions get evaluated when the page gets created, but by using the syntax {$$(expression ...)} as a hidden input form value Fox will evaluate it when the form gets posted.

So perhaps you need something like this (all on one line!!):

(:input hidden unit "{$$(if (test equal '{$$unitdoor}' '')

'{$$sector}{$$number}/{$$unitfloor}' '{$$sector}{$$number}/{$$unitfloor}/{$$unitdoor}' )}" :)

Note I have not tested this! HansB April 19, 2008, at 01:18 PM

Beautiful. Works like a dream. Thanks for the quick reply! Mike G? April 19, 2008, at 01:45 PM


Posting to Fox-Comments

Hi - i posted a question to to Fox-Comments and it got removed a day later. I wonder, what is the desired procedure for posting on this page? (It's odd having two places [here and the list] to potentially post questions)

  • is it preferred that we send our questions first to the pm-wiki users list?
  • would it ever be desired to post here and NOT on the list?
  • are there some questions / posts that are more appropriate for this page than others? and ones that would be more appropriate for the list?

Thanks! overtones99? March 30, 2008, at 05:27 PM

I am sorry. I thought you would have noticed, but I moved your very relevant questions to FoxNotify-Comments, and replied there, since they related specifically to FoxNotify. I try to keep questions to the relevant Fox application or sub-module if possible, and keep this page for all general Fox specific issues. I don't mind really if questions get posted on Comment pages here, or to the user list. The user list is a little more direct and may get a faster response (but I do monitor all the Fox pages). The user list also offers direct email response, which may be better for possibly more lengthy correspondence. My apologies for any confusion! HansB March 30, 2008, at 05:50 PM

oh great - didn't know that page existed! : ) i will take a look - thanks! overtones99? March 30, 2008, at 06:08 PM


Fox examples?

Hi, is there a page somewhere with a collection of working examples (i.e. not just code) of how Fox can be used? thanks! overtones99? March 12, 2008, at 11:26 PM

You can find a number of working examples on my site. See http://softflow.org/design/Fox/Fox, and also the Forum on my site is running with Fox. HansB

thanks. wondering if it might be appropriate to put links on the bottom of the main fox page to examples like those on your site? it's great to read about what Fox can do, but would be evermore enticing (and might make more sense to noobs like myself) with links to a couple examples sitting there ready to be clicked. just my 2cents. thanks! overtones99? March 15, 2008, at 01:24 AM


Hi, this is probably a dumb question, but I just can't get fox to work properly. If I create a page with the following content, just nothing happens if I push the GO button:

(:fox mytest foxaction=display:)
(:foxtemplate "'{$$arg1}'":)
(:input text arg1:) (:input submit post GO:)
(:foxend mytest:)
-- (:foxdisplay mytest:) --

If I add the line (:foxappend mytest:) to the page, regardless of its postion, everything works as aspected, i.e. arg1 shows up. What is it that I missed here? Or, if this should work without foxappend, where would I start searching for the error? Thanks

foxaction=display outputs to markup foxdisplay, so foxappend should not be used or needed. you need the latest fox.php for foxaction=display, please check! Otherwise your form should work. For error reporting you can add markup (:messages:) at the top at the beginning of a line. The foxtemplate line should not need the ' '. HansB February 29, 2008, at 07:15 AM

Thanks four your help! When adding (:messages:) at the top, it gives me "PERMISSION DENIED to display on Main.My!". I tracked this down in fox.php where it seems to me the variable 'strcheck' does not find a match. If I append my page with something like (:foxallow:) or putting an #top in the statement like this: (:fox mytest #top foxaction=display:), all works fine. I probably just missed some initial authentication? I tried all three options for "auth permission level" (edit,read,ALWAYS) at the top of fox.php, but this did not changed anything.

Whenever you get a Permission Denied error there is an issue with page permissions not being configured rightly. This is done with setting $FoxPagePermissions for the appropiate page pattern and to the foxactions one wants permitted. BUT it should work to display on the same page as the form is. So I will see if I can cure this bug for the next release. Thanks for your investigation and reporting this issue! HansB

PS: To fix this bug remove (#prepend|#append|#top|#bottom) from function FoxPagePermission near the end. I hope this does not invite really undesired foxactions when posting onto the same page. I need to think this through a bit. It may be better that page permissions need to be set, without excepting the page with the form?? HansB


Add a Link Downloads pmwiki.php

Hi, I am trying to use select page to add a link at the bottom of the page. The template looks fine, but when i click 'add a link' mozzilla tries to open/download pmwiki.php.

On PageListTemplates

[[#selectpage]]
(:template each:)(:input select pagelink[] "[[{=$FullName}|{=$Namespaced}]]" "{=$Namespaced}":)
(:template last:)(:input submit post "Add Link":)
[[#selectpageend]]

On Main.Test
(:fox selectcategory:)
(:foxtemplate "*{$$pagelink[]}":)
(:pagelist fmt=#selectpage group=Category name=-HomePage:)
(:foxend selectcategory:)

In config.php

$FoxAuth = 'ALWAYS';
$FoxNameFmt[] = '*.*';
$FoxConfigPageFmt = '{$SiteGroup}.FoxConfig';
include_once("$FarmD/cookbook/fox/fox.php"); // fox

Can you please let me know what you think the problem is.

thanks x

The input submit control should be in the fox form, not the pagelist template.
and in config.php instead of $FoxNameFmt use

$FoxPagePermissions['*.*'] = 'all';

Thanks for your help. I changed it, but when I click Add Link, its still tries to open up pmwiki.php. Is there some permissions I need to set somewhere?

I don't think so. But since you added your reply here above the following code I like to ask if you changed the pagelist template and the fox form using the code below, and not just the config.php? If you did, do you use a recent new version of fox.php? HansB

I did change the pagelist template, fox form and confi.php file. I downloaded fox.php from http://www.pmwiki.org/wiki/Cookbook/Fox within the past week so I believe its it the most recent version.

Pagelist Template

[[#selectpage]]
(:template each:)(:input select pagelink[] "[[{=$FullName}|{=$Namespaced}]]" "{=$Namespaced}":)
[[#selectpageend]]

Fox Form

(:fox selectcategory:)
(:foxtemplate "*{$$pagelink[]}":)
(:pagelist fmt=#selectpage group=Category name=-HomePage:)
(:input submit post "Add Link":)
(:foxend selectcategory:)

HansB February 14, 2008, at 04:57 AM


Problem after update from October 2007 version

After an upgrade from a version from October 2007 (around the 20th), my add-a-news-entry-page form fails to add forms. What happens with the new version of fox is that an error-message about the target page not existing is being displayed. After a downgrade to my old version, everything works fine again.

(:fox newnews template=News.Template redirect=1 :)
(:input hidden author value="{$Author}" :)
'''Title:''' \\
(:input text target size=30 value={$Today}- :) (e.g. ''{$Today}-MyNewsTitle'') 
...
(:foxend newnews:)

I'm trying to add a news page while being logged in as admin user, with FoxAuth set to edit.

Any help would be greatly appreciated - Nyhat February 9, 2008

It should work, the target page does not need to exist, it will be created. In the form above you do not give all details though. Try this form and see if it works (your form a little simplified):

(:fox newnews redirect=1 :)
(:foxtemplate "New News Page...":)
(:input hidden author value="{$Author}" :)
'''Title:''' \\
(:input text target size=30 :) 
(:input submit post 'create page':)
(:foxend newnews:)

Fox template markup \n is NOT converted into a new line.

For some reason all I get is "n" instead of an actual new line when I use "\n". No big deal but very weird. Don't know how but could it be a server thing? My host is extremely restrictive. Wasim February 06, 2008, at 03:10 AM

Normally you would not use \n in Fox templates. You use standard wiki markup and {$$Var} replacement variables. If I type \n here it will also just be shown. And linebreaks will just be linebreaks. I use \n in FoxNotify email templates, which is a very different output. And sometimes in php scripting for formatting output. HansB February 06, 2008, at 02:29 AM


Fox's delete button breaks PmWiki's email notification system for me

Pressing Fox's delete button causes duplicate emails to be sent out from my system for pages that I've set up for email notification. (I use PmWiki's NotifyList.) If I delete the same lines using PmWiki just one email notification goes out (the correct behavior). - RandyB February 4, 2008

Notify and Fox delete work fine for me on my site, i can't see the problem. HansB February 05, 2008, at 03:53 AM

Thanks so much to Hans for helping me track down the bug, and to Petko for suggesting a clean workaround. For anyone else who encounters this problem, enable Notify with this conditional in config.php:

if($action!='foxpost' && $action!='foxdelete' && $action!='comment') {

	$EnableNotify = 1;

}

- RandyB February 13, 2008


Interferrence with changed Default pages

Not a question and maybe too specific, but I thought maybe this info might be useful in case it happens to someone else: I changed the default group from Main to About and the default page from HomePage to Main ($DefaultGroup = 'About'; $DefaultName = 'Main';). This did not work properly, in that the page shown as start page was still Main.HomePage. After some testing it seems like the problem was that Fox was included in farmconfig.php, and the default changes in config.php, so after Fox: Moving include_once("$FarmD/cookbook/fox/fox.php"); in the config file below the default changes fixed it.

Anke January 10, 2008, at 11:47 AM

The fox.php script calls function ResolvePageName, just in case it needs this. And ResolvePageName shall only be called after the changes you made to $DefaultGroup and $DefaultName. So as you discovered it is best to include the script only in config.php after the changes. I think it is a good idea to include any recipe only in config.php, and not farmconfig.php, to be on the safe side. HansB


Hans,

I'm confused about the way $ScriptUrl works in the FoxDeleteMarkup function, and I know you were just working on it. I have created a blogging system wherein the comments are contained in a separate page (e.g. Comments.Group-Name) but are entered and displayed on the post's page itself (Group.Name). In fact, ?action=browse on a Comments.Group-Name page auto-redirects to Group.Name--so people never visit those pages (search engines dislike repeated content). So- I need a {[foxdelrange]} that produces the special Comments.Group-Name url--which is where the text is coming from anyway... At the moment, the url produced is the Group.Name url.

JonHaupt December 21, 2007, at 09:53 PM

Thanks for your alert, Jon! I myself was confused, and bungled the last change. I have now fixed this bug, and the delete links and buttons should work with clean urls and without and correctly point to the target page. I added a switch checking for $EnablepathInfo and setting a TargetPageUrl. HansB December 22, 2007, at 03:33 AM

Thanks, Hans. It works on my blog, so I've gone ahead and updated it. I also have a test site, which for some reason it doesn't work on... That site also uses clean urls, but they are in the style http://blah.com/pmwiki instead of in the root directory as they are in my blog. So $ScriptUrl is http://blah.com/pmwiki but the urls produced by {[foxdelrange]} are http://blah.com/Comments.Group-Name without the /pmwiki. I checked to make sure I'd set $ScriptUrl correctly and $EnablePathInfo=1... so I'm still a little confused about that. JonHaupt December 22, 2007, at 11:38 AM

Thanks, Jon! I forgot to declare ScriptUrl global in the FoxDeleteMarkup function. Fixed now. HansB December 22, 2007, at 01:30 PM

Excellent, thanks! By the way, I've been using Fox to make a lot of projects easier lately--it really is a great system. - JonHaupt


TextSection()

Hello, I just installed Fox on my wiki and this is is what turns out (trying the FoxCommentBox):

Fatal error: Call to undefined function TextSection() in [...]/cookbook/fox/fox.php on line 453

Ps: Thank you for pmwiki, I just needed something like that.

- Nick

You need to use PmWiki 2.2.0 beta 45 or later. Function TextSection was added only then I think. HansB December 16, 2007, at 02:56 PM


More on ToDo and Picklists

Hans,

I have gotten pretty close to where I wanted to get to using fox for todo and pick lists lists and I am wondering if you might have any ideas on how to go about the final step:

  • I use fox to process an input text box to generate input checkbox lines that are posed to the section called pending tasks.
    • Note the input checkboxes use an array for the name
  • I then use fox to process those input checkboxes to post one or more items from the pending section down to the completed section.
  • Having gotten that far do you see anyway to use fox to delete multiple lines from pending section?
    • The fact that I am using an array for the pending checkbox items makes me think that there might be some way, short of clicking each delete link, to delete the lines identified by checked values in the array.

I posted a working example on your site at Test/FoxToDoTest

Pico December 08, 2007, at 02:07 PM

Pico, I can't see a way right now to have one form line deleted while it posts another line. Maybe with a fox filter function, but it need s to launch the delete action after the new content is added. I need to think on this. HansB December 08, 2007, at 04:17 PM


Hi,

I successfully used commentboxplus and $BlocklistActions['comments'] = 1 in my config file against spam. Now I'm using fox for comments and it seems that blocklist doesn't work. At least I get the same spam in comments, I had before using blocklist. Is there a special trick or a special order neccessary in config.php? Or doesn't fox work with blocklist?

I'm using fox version 2007-11-19, pmwiki-2.2.0-beta63 and build in blocklist. Comments are written to special pages, e.g comments for "page1" are witten to "page1-Kommentare". Maybe that's a problem?

Thanks, NH

Please try $BlocklistActions['foxpost'] = 1; in config.php, and let me know if this works, as I have not tested blocklist with Fox, but would really like to know! Thanks! HansB November 25, 2007, at 06:36 AM

I made a few tests and blocklist didn't work with fox. Blocklist works with fox-forum. A quick and dirty hack is to insert the line
Blocklist($targetname, $addstring);
in fox.php function FoxAddEntry after
$addstring = FoxTemplateEngine($targetname, $template, $fx, '', 'FoxAddEntry');
But this is not tested very well and side effects may occur.

NH

If you add $BlocklistActions['foxpost'] = 1; to config.php then blocklist will act on anything posted in a form field named 'text' (this is the reason Blocklist works with FoxForum: FoxForum uses a textarea input box named 'text'). To make Fox more complient, so all postings in any field will be checked, it is necessary for the present Fox version to edit fox.php and add after ca line 367 (in the function FoxAddEntry), starting with:

$EditFunctions = array(... and before line starting UpdatePage(...

this:

global $EnableBlocklist;
     if($EnableBlocklist)
        array_unshift($EditFunctions, 'CheckBlocklist');

fox.php is now updated with this. HansB November 27, 2007, at 03:08 PM

Yes, this works. Thanks for patch (and scripts). NH


Summary= Argument: use an input field csum

How about adding summary= argument that populates the summary page variable on a page save? While you are at it, you could add an author= argument that populates the author field. Why? As I use fox more and more for changes the recent history conveys less information. With these arguments I can automate the population of these page variables to ensure that the recent history stays meaningful.

Pico October 10, 2007, at 05:17 PM

I am not sure what you like to achieve. If your form has a field which sets author, this will show in RecentPages. A summary can be provided by a field which sets csum: (:input text csum:) or (:input hidden csum "Comment added":) to have "Comment added" appear as change summary in RecentChanges when a post is made. Or use (:input hidden csum {$$heading}:) to supply a summary from an input field heading. csum will be used for the LastModifiedSummary var in RecentChanges. Without input for a summary you won't get any :-) . HansB October 11, 2007, at 06:52 AM

Thanks. I was focused on the fox directive and arguments and forgot to check the input directives.

Pico October 11, 2007, at 07:24 AM


Fox Shoutbox

Check it out - Shoutbox in the sidebar using this recipe. KMcC September 27, 2007, at 01:20 AM


Select multiple

Can fox recognize and make use of the multiple argument on select inputs? I have tried it when posting links to a page and only one of the selected items is posted. Would it be possible to have an array process an input selection so that more than one item could be specified and acted upon? Pico September 23, 2007, at 05:36 PM

I updated fox.php to handle array inputs properly. I hope I have not broken normal behaviour! Use in the select form name[] as the select form name, and in your template use {$$name[]}, i.e.:
(:input select name=abc[] 1 alpha size=3 multiple:)
(:input select name=abc[] 2 beta  selected=selected:)
(:input select name=abc[] 3 gamma :)

HansB September 24, 2007, at 11:51 AM

Thanks, it works great and does not seem to break anything that I have discovered.

Pico September 27, 2007, at 10:05 AM


Delete links feature request

Could the delete link feature be made to allow a deleted line to be archived (cut and pasted to a new location) instead of simply being deleted? If so, then a configuration setting could specify the archive location (where page variables could refer to the current group or page) and a directive such as (:foxappend archive:)could specify where on the page the archived line would be pasted.

Archiving deleted lines could be useful for todo or next action lists to indicate what items have been completed, by relocating them to a section that lists completed items.

Pico September 23, 2007, at 05:33 PM]

Alternatives

If archiving is not where you want to go, how about a link that allows you add a style (such as strikeout) to the current line? See Less Simple To Do. Or a check box that can be selected and unselected?

Pico September 29, 2007, at 08:03 AM

I would prefer a more general solution: I like to enable Fox to post fox forms defined in a template. That would allow all kinds of custom solutions. To do so requires modification of fox.php so replacement variables are handles differently if they are to be part of the posted fox form. I wonder if it is good enough to have Fox check if a replacement variable (in a template) has a corresponding field name in the form, in which case the replacement will take place. Otherwise no replacement will take place and the variable will be inserted instead. would that give rise to other problems? HansB September 29, 2007, at 09:08 AM

Yes, your more general solution sounds better, if I understand it correctly. Is the replacement variable just a value that toggles to direct whether to use a different portion of the template, or is it more like a replaceable PTV (like PM uses in PmForms)? In either event would it work when there are multiple items posted in a single page (would the variable require a unique name for each instance, or would it use the #foxbegin# like an anchor reference to distinguish one instance of the replacement variable from the next? Note that with PTV you can distinguish multiple instances on the same page by adding a reference to an anchor between the page name and the PTV name.

Pico September 29, 2007, at 09:26 AM

Note that #foxbegin# ... #foxend# does not provide unique IDs for field names, but only serves to provide unique section ID for the use of delete links and forms, if such are used in the template. If one wanted to post multiple fox forms, one would need to give each form a unique form name somehow.

Oh, I just saw your post to the mailing list here and I better understand your more general solution. Can Fox post regular input (or PmForm inputs) that use PTV through a Fox template, or does the current limitation apply to those as well as to Fox forms?

Pico September 29, 2007, at 09:35 AM

I have now implemented a solution which requires use of {$$$name} syntax in the template in order to post a replacement variable, i.e. {$$$...} gets posted as {$$...} and not replaced with a value.

PTVs will be posted as they stand. The problem was only with Fox's replacement variables. HansB September 29, 2007, at 01:10 PM

I am slow. Can you offer any hints about how I can use this new syntax to add a status functionality to posted add/delete (ToDO) lines? Thanks.

Pico September 29, 2007, at 06:39 PM

I am slow too! The changes are not enough for what you wish to achieve. I think Fox needs a genuine capacity to edit page sections. This was on my wish list anyway, and I will try to develop it. HansB


Question: Flash & video in comments?

Is there a way to use recipes for Google Video/YouTube/Flash/Quicktime in comments?

If you use one of the recipes to embed flash etc. into a wiki page, then you would need to enable posting of directives for Fox, so you can use embeding markup in a comment: $EnablePostDirectives = true;


Problem: Fox page permission settings ( I think!)

I am not able to delete any content using deleterange , deleteline markup. Here's my site. http://eatpotato.com/index.php?n=Main.HomePage

I set permissions in Site.FoxConfig, and local.config files, but still no changes! Any suggestions?

You may need to set in config.php: $EnablePathInfo = 1;
HansB July 24, 2007, at 01:51 PM

One more data collection question

Is it possible to make fox form erase former data? So that it don't add new entries to previous but deletes them. I changed the place of the public form hope it is now useable.

Fox does not delete content, it will append or prepend content. An exception is made with FoxForum which contains a foxforum.php script, which defines a ptvreplace filter. With that Fox can replace PTV values. HansB July 14, 2007, at 01:42 PM

http://taavi.org/twwk/pmwiki.php/Vorbis/Vorbis

Something happened to Categories - they don't work anymore. Could it be those conditions for nonexisting tags? Formely Categories did work right. Or is it this way to use two forms to make pages? Page names are just the same way as before: artist-album-track. So if I have a page RaymondHughes-LoveSong-02 and in that page category link to Raymond Hughes, it takes me to page Category/RaymondHughes. But the links in that page don't work.

I do not know. I have not studied your pages, sorry! HansB July 14, 2007, at 01:42 PM

Taavi


Data collection question

I try to make up form to collect metadata for flacfiles. My form and my question are here: http://taavi.org/twwk/pmwiki.php/Vorbis/Vorbis

Taavi

Taavi, I could not use your site! Here are my answers:

  • To retain values in fields try the local customisation describes under $InputValues: InputDefault#values
  • To exclude empty fields being shown on target pages use conditional markup on the template page which checks the field is not empty, like this:
(:if ! equal {$$performer1} "":)Performer: {$$performer1}
(:if ! equal {$$performer2} "":)Performer: {$$performer2}
(:if ! equal {$$performer3} "":)Performer: {$$performer3}
(:if:)
HansB July 12, 2007, at 09:59 AM

Thanks

The conditional markup you suggested worked fine. I got my form working too but I had to do it with two separate forms in the same page. First one using pmform recip and second one using fox. Complicated perhaps but it works. I tried to make the page and form usable for everyone but didn't manage. Here we see how secure PmWiki is!

Taavi


Guibuttons

If in a post a user enters a link to new wikipage and this page is then edited, then there seems to be a confusion as which buttons to use? The guibuttons directory is still (incorrectly?) used, but guiedit buttons are displayed. As only some buttons exist in both directories, we get a partial display. Using only one or the other everywhere is probably best, but not necessarely desirable in all cases. -JHJ

This seems to be a GuiButtons question (used in the fox forums). Perhaps we can move it there? I will think about this though, but have no immediate answer. HansB


Internationalizations

It seems that Fox is not quite set up for internationalizations yet? In the Forum I added the $[...] convention to all text strings in all templates and files and then added the appropriate translations to the XLPage-pages. This worked fine, but should not at least the $[...] convention be included in the standard distribution, so we don't need to do the substitutions after each new release? -JHJ.

Sorry, yes I have not included internationalizations, yet. Fox and its various applications are still evolving and not polished at all yet. There seemed to be little point in providing XL support, if strings used are still changing. It needs to be more stable first. HansB


Login No Password (Author / Guest List)

I want to record guest visits. I put a fox comment box on the front page of my site. I copied the code for the comment box and took out header, message. And I copied the template: Also removed the header and message codes. Templates were put in the default locations. I don't understand fox. That's about the extent of my web design knowledge (copy and paste). I followed the recipes. I redirected the target. I put the code to authorize all fox posts in my local config (I have a sitewide admin password and all pages locked to admin editing). I've succeeded in prepopulating the author form (on subsequent visits), authors show up on my stats page, and their names are already filled in on the forum (so I've acchieved "sign in"). My problem, there is no output on the target page (the comment box is on the home page and the target page is in a different group: Guests.GuestList). There is no code on the GuestList page (should there be)? How do I record the author name and time of visit on the GuestList page? http://vintage45s.biz Brett

I guess you may not have set permission for Fox to post to Guest.GuestList. Put into config.php:
$FoxNameFmt[] = 'Guest.GuestList';
This will allow posting to that specific page. To allow posting to group Guest change it to 'Guest.*'; To allow posting anywhere change to '*.*'. As you have strict edit control on the pages this last one may be fine for you. Fox is just a bit safety cautious in granting authors possibilities to write forms which could post to pages which should not b eposted to. So with simple wildcard characters a pagename "mask" can be created. More examples are in fox.php near the top. HansB

Foxfilters

Is the documentation up-to-date? I got the foxfilters working only after replacing "function MyCustomFilterFunction($fields)" with "function MyCustomFilterFunction($pagename, $fields)". I needed this in the Contact application because contact names often contain umlauts and other special characters (incl '.', ','...). Unprocessed contact names do not work well as filenames -JHJ.

Thanks for pointing this out! I updated the documentation. Yes any foxfilter function needs both $pagename and $fields. HansB

Forum layout

I really like what you’ve done with Fox. I’d like to use it in my site to set up a forum and maybe use it for comments. I’m wondering about how to set it up to make FoxForum look more like a mainstream forum (phpBB and such). I realize what Fox is what some of its limitations are, but I’m curious about a few things.
Thank you for your interest! Please have a look at a new forum prototype I am working on: softflow.co.uk/design/ForumX/ForumX. This is a new Fox-based forum using a page per post (instead of all posts of one topic/thread on one page). More info on the welcome page there. I plan to use some of the features also for the one-page-per-topic FoxForum. HansB

  • Can you use PmWiki’s graphical editing buttons with Fox? I’d like to use FoxForum and/or CommentBox but be able to use the various formatting, such as bold and underline. I’d like users to be able to just use PmWiki’s buttons, rather than manually type in the formatting.
Yes. See softflow.co.uk/design/Test/TestCommentBox2. The guibutton markup i use there can work for any textarea input control (multi-line text box). The input markup needs id=text, and then the javascript guibuttons will output into the box. I may release a update on this later.
Update: released now as GuiButtons. HansB April 11, 2007, at 10:15 AM
  • How could I change the formatting of FoxForum so that the user’s name is on the side of the post, rather than on top of it? Again, I want the forum to look more like a phpBB forum. Is there a way to have, for example, a frame on the left side of the post with the user’s name and then the actual message in a frame (or whatever method you use in Fox) just to the right of it? In the frame with the user’s name, would it be possible to link to a picture, so that user’s could have a forum icon?
Using Fox this can be done by redesigning the comment template. But be aware of width restraints due to the pmwiki sidebar. I could prototype a template page for this. HansB
  • How many forum threads or comments can appear on a page? Is there a way to limit the number of entries and then have the older entries appear on different pages? For example, I set up a FoxForum, but I want to display twenty threads per page, pretty much like other forums. I’m just wondering that if a forum gets very popular that there might be hundreds of threads/comments on a single page. Also, is there a way to alternate the colors of the forum threads on the main page?
For SimpleForum I used BreakPage breakpage2.php for CommentBoxPlus. I still like to adapt it for use with Fox. It is a matter of inserting after every 20 or so posts a breakpage comment marker (invisible). I should get this done soon.
Update: Done now in ForumX. HansB April 11, 2007, at 10:15 AM
  • I’d really like to have a blog-like front page and comments for my site. So far, Fox looks like it fits the bill, but I know that PmWiki is supposed to have these functions built into it in the future. Will some of these Fox functions become obsolete when PmWiki includes them automatically? I’m concerned about setting everything up in Fox and then needing to change everything in the (hopefully) near future when PmWiki has this functionality built in.
PmWiki 2.2.0 is not released yet. Fox is based on 2.2.0 beta, and also in beta state. So it is an evolving script, and some bigger changes may be necessary still. That said, I don't think that any future comments capabilities in PmWiki will make Fox dysfunctional. Most likely it will open the door to make some code used in fox simpler. HansB

Watch out for parameter usage mistakes

(:fox pform #top redirect=1 target=Pos.C template=Template.Pos :)
|| '''Pos:'''||(:input text target size=60:) ||

can you see the problem? target is specified twice. This makes Fox silently fail creating new pages. It's an easy mistake to do. SteP

I have not seen a silent page creation failure. There is always a possibility that input controls get identical names. What exactly happens in such cases is not quite clear. Fox provides two ways for setting a number of parameters. So some care is needed. Thanks for the head-up! HansB
One way to get a silent page creation failure: omit both template and templatestring (or set templatestring to ""). The script will eventually redirect to the current page after echoing that a template is mandatory. Technically it isn't silent, practically it is, however, as a user can't really see echoed output.
I think it is correct that Fox returns to the current page if no template could be found. But I plan to have the error echoing changed into a message system. Still using echo to report errors is better than nothing. HansB

Use foxgroup for setting target group

Hans, in the newpageboxplus recipe you have a parameter base=BaseGroup.NewPage that allows setting a base group where NewPage is created. Since Fox can create multiple pages, but newpageboxplus can't, it would be great if Fox supported a base= parameter too, so we could create a list of pages in another group with a single form

(:fox p base=Group target=A,B,C template=Templ.OneForAll:)

would create Group.A, Group.B and Group.C all templated with Templ.OneForAll. SteP

Does foxgroup=Group not work for this? Below is a NewGroupBox.HansB
(:fox box1 #top redirect={$$foxgroup}.A target=A,B,C template=Templ.OneForAll:)
(:input text foxgroup "" size=20:)
(:input submit post "New Group":)
(:foxend box1:)

New Group Box and $FoxNameFmt

I am trying to get a sort of NewGroupBox function using Fox, where it must create the home page of a new group. But it seems to do, well, nothing useful but create a form:

(:fox npgrp #top redirect=1:)
(:input hidden target value="GTD-Projects-{npg}.HomePage":)
(:input text npg value="Test" size=20:)(:input submit post "New Project Group":)
(:foxtemplate "'''{npg} Project Group'''":)
(:foxend npgrp:)

The form displays correctly, but when I press the button, nothing happens. It works if I create a page without specifying a group. I've also tried setting the foxgroup parameter, but that doesn't help either. Any thoughts? -- rlt, 2007-Mar-28

For creation of new pages in a different group make sure you add a valid pagename pattern to $FoxNameFmt. In your case add something like this to config.php, before including fox.php:
$FoxNameFmt['GTD'] = 'GTD-Projects-*.*';

HansB March 28, 2007, at 10:55 AM

Thank you! That does what I need. -- rlt


Blank pages

Looks really promising, but once I follow the cookbook for the Forum, when I enter a topic and click, I'm directed to a blank page. What should I check for? Thanks. Make sure you use latest PmWiki 2.2.. -Rene


Problem with PageTextVariables - solved

After updating to the 3/10 release, other recipes where having trouble accessing page text variables. E.g., I have a "commentcontrol" page text variable in a directive:

(:commentcontrol:open:)

With the previous version of Fox I could access this value with PageTextVar and get the value open. With the 3/10 version of Fox, it is a null string. If, in the 3/10 version of Fox, I comment out the definition of the page variable $CounterInc, everything works again. What is $CounterInc anyway? I don't see it used in the rest of the recipe, nor documented. -- rlt, 2007-Mar-13

Sorry that code piece should have not gone into the release! Now removed. I was working on a method of increasing a page text variable value incrementally by one. HansB March 13, 2007, at 09:02 AM


Very cool! The example pages were helpful. Thank you. Pico


Creating page target

I'm busy trying to figure out a way to merge strings given by input fields to create a new "target"-string. For Example:
[...]
(:input text author size=20:)
(:input text title size=20:) [...]

How to merge both strings ("author" and "title") to one, which then goes as "target"? I want to create new pages using Fox (and templates provided by Fox template sites) with nmaes like "[Group].taget", but "target" should be put together out of 2 other strings (e.g. target=author+title)

Someone knows a way to do that? I'm not very familiar with all that... SimonB

Try this in the fox form (not in the template page): (:input hidden target "{$$Author}{$$Title}":) - HansB
This is now directly supported by Fox, please see the "Field substitutions" portion of the documentation. -- Feral April 13, 2007, at 03:40 PM

Foxtemplate for single line template strings

(:foxtemplate "template string":) works only with very simple templates. I tried:

(:foxtemplate "[=#foxbegin#=]\n{toto} [={[foxdelrange button]}=]\n[=#foxend#=]\n=]":)

and this doesn't work...

Pierre Racine

(:foxtemplate "...":) works only with single line template strings. If you need a multiline template, you need to create a template page with it, and call it via (:fox ... template=MyTemplatePage :) - HansB


Dan Raymond I get "Call to undefined function UpdatePage() in C:\Program Files\EasyPHP 2.0b1\www\pmwiki\cookbook\fox.php on line 230" any ideas???

You need to update to the latest pmwiki 2.2.0 beta. - HansB

Mike Bishop Very nice, replaced both comment boxes and forum based on your examples. Some "gotchas" on the Forum

  • make sure wikiword spacing is on (1) if you want nice topic displays;
  • I added an access code to the forum. This allowed posting to an existing topic, but prevented creation of new topics!
Workaround: Group.Page.php customization that set $EnableAccessCode = false for the index page.
Or add access code to the form which creates a new topic as well. HansB
Yes, of course! It makes little sense to protect additions to a topic but not topic creation [mrb]

Edit - History - Print - Recent Changes - Search
Page last modified on June 19, 2008, at 10:37 AM