[pmwiki-users] WikiForm - wikilist searching (Peter & Melodye Bowers)

Peter & Melodye Bowers pbowers at pobox.com
Thu Oct 25 02:13:31 CDT 2007


(resend with correction to #3)

It does appear to be an issue of case.  When I put in your echo statement it
had converted my variable names to lowercase and nothing worked.  When I
changed variable names to lowercase I can now select.

Problem solved.  Thanks for the pointers in the right direction.

3 other issues arose in the process which aren't urgent, but may need to be
addressed at some point:

(1) Variable names need a little more flexibility.  I had already noticed
(and put in a feature request on the wiki) that underscores in a variable
name cause that field to be ignored.  Now the problem with uppercase shows
in the selection.  An intentional definition of the syntax of a variable
name should be made and then applied throughout.  "[A-Za-z_][A-Za-z0-9_]*"
is pretty standard in other languages although I'm not familiar with php...
(Hyphens might be nice too?)  (Case insensitive might be nice although
others might have other preferences and perhaps PMWiki already has a
standard?)

(2) This may be by design but I don't really catch the motivation...  In the
data page the data is stored prefixed by the *prompt* rather than the
variable name.  In other words I get ":Please enter the author:Smith, John"
in the page 00001 instead of ":author:Smith, John".  Again, there may be
some very good reason for this, but it seems to me like prompts will change
far more often but variable names should theoretically stay much more static
and so the data should be attached to the variable name and not the prompt.
That way I can fix the hypothetical typo in my prompt without having to go
through and re-edit each and every data-page to get it fixed.  (Also it
seems like it would speed up selection slightly if you didn't have to go
through a mapping process of prompt->variablename in the (:wikilist
name=value:) selection.)  

(3) I went through and edited the data-pages with ?action=edit instead of
?action=editeform, thinking that would make things faster.  It saved me a
few minutes editing, but somehow I was suddenly unable to get *ANY* results
from (:wikilist:).  I went back and edited them with the form and it fixed
the problem.  I can't figure out exactly what caused it, but <pure guess>I'm
guessing something with the mapping of prompt to variable name got messed up
when I edited the data directly...?  So this would go down to user error if
#2 is truly by design.  On the other hand it might be further weight on the
side of having variable names rather than prompts in the datapage.</pure
guess>

-Peter

> -----Original Message-----
> From: pmwiki-users-bounces at pmichaud.com [mailto:pmwiki-users-
> bounces at pmichaud.com] On Behalf Of John Rankin
> Sent: Thursday, October 25, 2007 12:42 AM
> To: pmwiki-users at pmichaud.com; pmwiki-users-request at pmichaud.com
> Subject: Re: [pmwiki-users] WikiForm - wikilist searching (Peter & Melodye
> Bowers)
> 
> On Thursday, 25 October 2007 9:27 AM, pmwiki-users-request at pmichaud.com
> wrote:
> >   4. FW: WikiForm - wikilist searching (Peter & Melodye Bowers)
> >
> >Any thoughts on selecting pages using the (:wikilist variable=value:) as
> >below?
> 
> Unfortunately, this works for me; see for example:
> http://www.wikipublisher.org/wiki/index.php?n=Issues.SuspendedIssues
> 
> You will see that instead of "Select all items" it says "Select
> Status=suspended".
> 
> I think the first thing to do is remove all possible extraneous variables,
> by testing this with a plain install of pmwiki plus the wikiforms recipe.
> Second (although it shouldn't make a difference) use all lower case
> variable names.
> 
> I'd also test it with pmwiki version 2.1.27, which is a known quantity.
> It is possible that something in pmwiki has changed and broken the recipe,
> although I do not know what this might be.
> 
> If that doesn't work...
> 
> Then I would edit the wikiform.php code and in the FmtEntryList function
> look for the code that sets $caption.= ... If you insert suitable echo
> statements you may be able to work out why the value of
> $opt[$f[$i]['element']] is not being picked up. For some reason,
> it is not receiving and processing the field=value setting.
> 
> You might try adding something like:
> 
> foreach($opt as $k => $v) echo "$k=$v";
> 
> This should return (for example) Type=Booklet. Insert this just
> above the for($i=0;$i<count($f);$i++) line.
> 
> JR
> >
> >
> >
> >Any thoughts on anchoring that substring search if the search is indeed
> >possible, as below?
> 
> I think I can make it do exact matches; for example, the author could
> write type==book and it would match book but not booklet. Let me
> see if that can be made to work.
> >
> >
> >
> >-Peter
> >
> >
> >
> >I am thrilled with the capabilities of WikiForm - it never occurred to me
> >something so powerful could be implemented as simply as you have made it!
> >Bravo!  (I'm using it to keep a sort of database of published literature
> in
> >the Albanian language)
> >
> >
> >
> >1st question: from the documentation it looks like (:wikilist
> >EngTitle=Wind:) should give me a list of pages where the variable
> "EngTitle"
> >contains the text "Wind".  However, no matter what variable names I put
> in
> >and no matter what values I put in I always end up with a complete list
> of
> >all pages in my WikiForm rather than some subset.  (See
> >www.ccl-al.org/pmwiki/pmwiki.php?n=X.X for my test-site example - I've
> >removed the search criteria right now because I couldn't make
> >it work)
> >
> >
> >
> >2nd question: is there any way to anchor the substring search?  In other
> >words EngTitle=a as I understand it would match all pages where the
> >"EngTitle" variable contains the letter "a".  Is there any way to anchor
> >that ala ^ or $ or something like that?  (For instance, one of my
> variables
> >is "type" and indicates whether the piece of literature is a Book or a
> >Booklet.  If I search for "Type=Book" then by my understanding it will
> >return BOTH "Book" and "Booklet" results when I obviously want just
> "Book"
> >in that case.)
> >
> >
> >
> >-Peter
> 
> 
> --
> John Rankin
> Affinity Limited
> T 64 4 495 3737
> F 64 4 473 7991
> 021 RANKIN
> john.rankin at affinity.co.nz
> www.affinity.co.nz
> 
> 
> 
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users






More information about the pmwiki-users mailing list