Re: Parsing search query to the $opt variable

Gregor Klarič <[email protected]>
Newsgroups gmane.comp.web.wiki.pmwiki.user
Message-ID <CA+whS2JPG6KYhW9o1BxggfMtwVx2q+odKPKy+7EoV5NuATBwfA@mail.gmail.com>
Thank you Petko, I got it working.
Ultimately, the problem was not (only) in the $opt building process, but I
had the markup executed at the wrong time in the page creation process.
I had it with 'style", but at that time in the  $query
 "'''UPORABNOST''': strupen
has already been converted to
 <strong>UPORABNOST</strong>: strupen, and thus it never found the phrase
on the pages.
I moved the markup to <inline,  and now it works correctly.

Am Mi., 28. Juni 2023 um 13:54 Uhr schrieb Petko Yotov <[email protected]>:

> In theory, you should be able to do something like this:
>
>    $query = "seznam×nadaljevalni \"'''UPORABNOST''': strupen\"
> name=-$pagename";
>
>    $opt = ParseArgs($query, $GLOBALS['PageListArgPattern']);
>
> This should populate the $opt array like this:
>
>    $opt = [''=>["seznam×nadaljevalni", "'''UPORABNOST''': strupen"],
> 'name'=>"-$pagename" ];
>
> Or you can define this array yourself if it makes more sense to you.
>
> The element with an empty key $opt[''] is an array with all words or
> phrases that are required to be in the page texts.
>
> Then you should be able to use this with:
>
>    $list = []; # defined before next line
>    FPLTemplatePageList($pagename, $list, $opt);
>    # use $list
>
>
> In pagelist.php, the parsing of the query string happens in the first 30
> lines of FmtPageList() but indeed it is complicated to follow, as these
> are merged with some default settings, and with any request variables.
>
> Petko
>
>
> On 28/06/2023 13:18, Gregor Klarič wrote:
> > I am using the  FPLTemplatePageList function in a custom markup in
> > this way
> >
> > $opt = [''=>$searchwords, 'name'=>"-$pagename" ];
> >  FPLTemplatePageList($pagename, $list, $opt);
> >
> > where  $searchwords is an array of the search words which I am
> > providing by parsing the parameters of my markup. I don't seem to
> > parse it right though.
> >
> > I would like to parse this search query as it is:
> > seznam×nadaljevalni "'''UPORABNOST''': strupen"
> >
> > to produce this result:
> >
> >
> https://www.gobe.si/Gobe/AgaricusAugustus?fmt=%23title&order=title&name=-*RecentChanges*&action=search&q=seznam%C3%97nadaljevalni+%22%27%27%27UPORABNOST%27%27%27%3A+strupen%22
> >
> > but I can not find the piece of code in pagelist.php that pases this
> > and builds the correct  $searchwords and  $opts variable.
>

_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.