$main = array( 'package' => 'faqman', 'packagePath' => '{core_path}components/faqman/model/', 'class' => 'faqManItem', 'fields' => 'question,answer', 'withFields' => 'question,answer' ); // set the query hook declaration $qhDeclaration = array( 'qhVersion' => '1.2', // version of queryHook - to manage futures changes 'main' => $main, ); $hook->setQueryHook($qhDeclaration); return true;
[[!AdvSearchForm? &landing=`18`&queryHook=`FAQHook`]]
<h2>Results</h2> [[!AdvSearch]]
This question has been answered by nir-z. See the first response.
[[!AdvSearchForm? &landing=`18`]]
<h2>Results</h2> [[!AdvSearch? &queryHook=`FAQHook`]]
Hi laforge,
I think that the queryHook belongs in the AdvSearch snippet, not the AdvSearchForm
[[!AdvSearch? &queryHook=`FAQHook`&debug=`1`]]
SELECT DISTINCT `faqManItem`.`id`, `faqManItem`.`question`, `faqManItem`.`answer` FROM `faqman_items` AS `faqManItem`
ERROR 1146 (42S02): Table 'modx.faqman_items' doesn't exist
$main = array( 'package' => 'faqman', 'packagePath' => '{core_path}components/faqman/model/', 'class' => 'faqManItem', 'tablePrefix' => 'modx_', 'fields' => 'question,answer', 'withFields' => 'question,answer', 'sortby' => 'question DESC' ); // set the query hook declaration $qhDeclaration = array( 'qhVersion' => '1.2', // version of queryHook - to manage futures changes 'main' => $main ); $hook->setQueryHook($qhDeclaration); return true;