Re: Parsing search query to the $opt variable
Petko Yotov <[email protected]>
| Newsgroups | gmane.comp.web.wiki.pmwiki.user |
|---|---|
| Message-ID | <[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