Hello! I'm trying to implement hook_search_page in order to alter the search results page. I made a module called soverride and put this in it:
/**
* Implement hook_search_page to change the search page
*/
function soverride_search_page($results, $type) {
$output = '<dl class="search-results">';
print 'hello world';
foreach ($results as $entry) {
$output .= theme('search_item', $entry, $type);
}
$output .= '</dl>';
$output .= theme('pager', NULL, 10, 0);
return $output;
}I do not see hello world.
In order to troubleshoot this I placed the print statement outside of this function and saw "hello world" fine so I know that the module code is being used. I also tried hacking core and placing this print statement in this function in search.module and I saw it appear (with the soverride module disabled of course). Am I missing something obvious?
Edit: I removed my second question but now I'm asking it again. Still stuck.
And while I'm on the subject, I tried doing a var_dump of $results while I was in search.module and I found a spot in there that I'd like to reference. I tried printing it but it complained that I couldn't use the object as an array. Ok, so it's an object not an array. How would I get to here for instance?:
array(1) {
[0]=>
array(9) {
["node"]=>
object(stdClass)#22 (320) {
["nid"]=>
string(3) "943"
I see the object is "node" but how would I say something like print $results[0]["node"]["nid"]?
Comments
bump
Still wondering about both these questions. Anyone?