You need to login to send post. No account yet? Create one:
Create account
Hide the author of node and date in Drupal search
Sat, 01/23/2010 - 23:40
I feel that sometimes is Drupal too complex - there is a lots of informations which I want to disable, but there is no such option. Is possible to switch of name of author of node and date of creation in Drupal search result. Thanks you in advance, but I am more designer than coder...
Mon, 10/11/2010 - 19:42
#2
... the simplest way for me
... the simplest way for me was to copy the search-result.tpl.php from modules/search to my theme path (consider replacing hyphens by underscores) and to simply remove the line printing the $info.
dont forget to rebuild the theme registry ;)
mvalverde (www.explido-software.de)



















In this case should webdesigne use Drupal hook function. All is done in your template.php file in theme folder, but you have to copy into folder of your theme file 'search-result.tpl.php' from search module folder too. This PHP snippet is from http://koobmeej.blogspot.com/2008/10/theme-drupal-search-results.html and implementation is for ZEN theme in Drupal 6.
$hooks['search_result'] = array(
'arguments' => array('result' => NULL, 'type' => NULL),
'template' => 'search-result',
'path' => drupal_get_path('module', 'search')
);
function phptemplate_preprocess_search_result(&$variables) {
$result = $variables['result'];
$variables['url'] = check_url($result['link']);
$variables['title'] = check_plain($result['title']);
$info = array();
/* HIDE THIS FROM END USER
if (!empty($result['type'])) {
$info['type'] = check_plain($result['type']);
}
if (!empty($result['user'])) {
$info['user'] = $result['user'];
}
if (!empty($result['date'])) {
$info['date'] = format_date($result['date'], 'small');
}
if (isset($result['extra']) && is_array($result['extra'])) {
$info = array_merge($info, $result['extra']);
}
*/
$variables['snippet'] = isset($result['snippet']) ? $result['snippet'] : '';
$variables['info_split'] = $info;
$variables['info'] = implode(' - ', $info);
$variables['template_files'][] = 'search-result-'. $variables['type'];
}