The postHook parameter is a name of snippet.
The postHookTpls parameter is a csv list of tokens. This could be a csv list of chunk names used inside the postHook snippet to modify the presentation of results.
In this
example the advSearch snippet call is:
[[!AdvSearch?
&pagingType=`0`
&fields=`pagetitle,longtitle,menutitle`
&queryHook=`PlanningQHook`
&container=`planningTableaux`
&tpl=`planningTableau`
&postHook=`PlanningPHook`
&postHookTpls=`planningEntete,planningSalle,planningLigne,planningSession,planningSessionVide`
&withAjax=`1`
&ids=`[[!GetIds? &ids=`c24`]]`
&perPage=`7`
&withTVs=`jour,discipline,professeur,niveau,public`
&includeTVs=`salle,horaire`
]]
In this example, the web user select one or several days of the week, the name of a professor, the type of danse, the level and the public type. Then the planning is displayed.
Results are not displayed as a list of results but as a table per day of the week with the name of room as row.
The filtering is done by using the queryHook. The displaying of results has been done by using the postHook.
Inside the posthook snippet you can get the results by:
$searchResults = $advsearch->searchResults;
$results = $searchResults->results;
$nbr = count($results);
Then you could set up the results you want and then provide these results to AdvSearch by:
$searchResults->results = $newres;
$searchResults->resultsCount = count($newres);
and you could modify the fields names by:
$searchResults->mainFields = array('jour','planningHeader','planningBody');
$hook->updateResults($searchResults);
And use these new fields inside each result. In the above example, I have one result per day.
[ed. note: coroico last edited this post 14 years ago.]