How can I edit the way the search results are displayed? I looked into theme.php on /sample, but I couldn't find anything specific for search results, and I had no idea which other section it could be.
Thanks.
Do you want to edit the actual results or just the appearance / layout?
Just the appearance. Right now, the title and thumbnail of each album result are display each in a different table row. I'd like for them to be in someway similar to how albums are regularly displayed on the gallery.
Open include/search.inc.php, find
starttable('100%', $lang_meta_album_names['album_search'],2);
while ($alb = mysql_fetch_assoc($result)) {
$thumb_query = "SELECT filepath, filename, url_prefix, pwidth, pheight "
." FROM `{$CONFIG['TABLE_PICTURES']}` "
." WHERE (`aid` = '{$alb['aid']}') "
." AND approved = 'YES' "
." ORDER BY `pid` DESC";
$thumb_result = cpg_db_query($thumb_query);
$thumb = mysql_fetch_assoc($thumb_result);
// TODO: query above only pulls in last_pid in each album, not correct album thumb as set by user
$thumb_url = get_pic_url($thumb, 'thumb');
$thumb_size = compute_img_size($thumb['pwidth'], $thumb['pheight'], $CONFIG['alb_list_thumb_size'], true, 'cat_thumb');
?>
<tr>
<td colspan="3" height="1" valign="top" class="tableh2">
<span class="alblink"><a href="<?php printf("thumbnails.php?album=%u", $alb['aid']); ?>"><?php echo $alb['title'] ?></a></span>
</td>
</tr>
<tr>
<td colspan="3">
<img src="images/spacer.gif" width="1" height="1" border="0" alt="" /><br />
</td>
</tr>
<tr>
<td>
<a href="<?php printf("thumbnails.php?album=%u", $alb['aid']); ?> ">
<img src="<?php echo $thumb_url?>" class="image" <?php echo $thumb_size['geom'] ?> border="0" alt="<?php echo $thumb['filename'] ?>">
</a>
</td>
<td width="100%" valign=top>
<?php if ($alb['description'] == "") { echo ' '; } else { echo $alb['description']; } ?>
</td>
</tr>
<?php
}
endtable();
echo '<br/>';
and replace with
global $template_thumbnail_view;
$template_thumbnail_view_tmp = $template_thumbnail_view;
$thumb_cell = template_extract_block($template_thumbnail_view_tmp, 'thumb_cell');
$empty_cell = template_extract_block($template_thumbnail_view_tmp, 'empty_cell');
$row_separator = template_extract_block($template_thumbnail_view_tmp, 'row_separator');
$i = 0;
$thumbcols = $CONFIG['thumbcols'];
$cell_width = ceil(100 / $CONFIG['thumbcols']) . '%';
starttable('100%', $lang_meta_album_names['album_search'], $thumbcols);
while ($alb = mysql_fetch_assoc($result)) {
$thumb_query = "SELECT filepath, filename, url_prefix, pwidth, pheight "
." FROM `{$CONFIG['TABLE_PICTURES']}` "
." WHERE (`aid` = '{$alb['aid']}') "
." AND approved = 'YES' "
." ORDER BY `pid` DESC";
$thumb_result = cpg_db_query($thumb_query);
$thumb = mysql_fetch_assoc($thumb_result);
// TODO: query above only pulls in last_pid in each album, not correct album thumb as set by user
$thumb_url = get_pic_url($thumb, 'thumb');
$thumb_size = compute_img_size($thumb['pwidth'], $thumb['pheight'], $CONFIG['thumb_width'], true, 'cat_thumb');
$params = array(
'{CELL_WIDTH}' => $cell_width,
'{LINK_TGT}' => 'thumbnails.php?album='.$alb['aid'],
'{THUMB}' => '<img src="'.$thumb_url.'" class="image thumbnail" '.$thumb_size['geom'].' border="0" alt="'.$thumb['filename'].'">',
'{CAPTION}' => '<span class="thumb_title thumb_title_title">'.$alb['title'].'</span>',
'{ADMIN_MENU}' => '',
);
echo template_eval($thumb_cell, $params);
if ((($i % $thumbcols) == 0) && ($i < mysql_num_rows($result))) {
echo $row_separator;
}
$i++;
}
for (;($i % $thumbcols); $i++) {
echo $empty_cell;
}
endtable();
echo '<br/>';
That worked, thanks.
Just one thing: the first result for the albums is on its own table, taking the whole width. (example: http://stanakaticbrasil.com/galeria/thumbnails.php?search=choice&title=on&album_title=on&category_title=on&caption=on&keywords=on&filename=on&album=search&type=OR)
Also, the albums thumbnails aren't the right size or proportion (like the photo results are, for example).
Did I do something wrong?
Sorry for the late reply. Not sure if you have the mod still applied, but currently the search results look like the unmodified results. Please re-apply the mod, so I can have a look what's wrong.