I defined MYTHEME_preprocess_search_results function in template.php file in my theme:
function MYTHEME_preprocess_search_results(&$variables) {
$variables['search_results'] = '';
foreach ($variables['results'] as $result) {
$node = node_load($result['node']->nid);
$variables['search_results'] .= node_view($node, TRUE, FALSE, FALSE);
}
$variables['pager'] = theme('pager', NULL, 10, 0);
$variables['template_files'][] = 'search-results-'. $variables['type'];
}
After clearing cache search results are not displayed. If not use node_view, than all ok!
I do (/try) this:
- Reindex site content
- Installed new site with drupal 6.19 (Also has disabled all unnecessary modules) and tried this code again
- Played with MYTHEME_preprocess_search_results, MYTHEME_preprocess_search_result, search-results.tpl.php, search-result.tpl.php
- Created a new template in a separate file and used it instead of MYTHEME_preprocess_search_result (in original template_preprocess_search_results used
$variables['search_results'] .= theme('search_result', $result, $variables['type']))
- Reviewed many lines of drupal core code in theme and search systems and try debug it
- Used google many many times (and find this)
After all I tried this: watched a approximately version used on the link above. Downloaded and installed drupal 6.14 and tried my code. All worked as needed!
May be my bug, #751146: template suggestions doesn't applies when template file placed in theme subfolder and #732774: Pager does not show when using node_view as teasers are linked.
Comments
Comment #1
CkPoMHbIu commented