[*1] my answer to the question involves the search page. But I feel it's an incomplete answer since the page is listed as "Search Results" and has other "search" related text on it. It would be nice if the Search class could be called independently of the URL passed in. So here's the hack. Change the constructor for Search from
Text Formatted Code
function Search()
{
global $_CONF;
// Set search criteria
if (isset ($_REQUEST['query'])) {
$this->_query = strip_tags (COM_stripslashes ($_REQUEST['query']));
}
// ,,,,
Text Formatted Code
function Search($A = null)
{
global $_CONF;
if (empty($A)) $A = $_REQUEST;
// Set search criteria
if (isset ($A['query'])) {
$this->_query = strip_tags (COM_stripslashes ($A['query']));
}
// ,,,,
Now you can call the search function from code with your own criteria.
Text Formatted Code
$args = Array(
'type' => 'stories',
'topic' => 'plugins',
'results' => 20,
'page' => 1
);
$search = new Search($args);
$retval = $seach->doSearch();
Of course a better interface to $this->story_results would also help but that's beyond the scope of a hack. Something that broke up the _formatResults function into its components so the caller could create the table outside of the "search took 1.03 secs" stuff.