Page 1 of 1

Icon on search results too

Posted: Sat Apr 28, 2007 1:21 pm
by Marcus Wendel
How can I modify the phpbb-files to get the Attachment Topic Icon to be displayed on the search results as well?
Thanks.

/Marcus

Posted: Sun Apr 29, 2007 9:47 pm
by DavidIQ
A few modifications to what I had already shown you on phpBB.com:

Code: Select all

# 
#-----[ OPEN ]---------------------------------------------
# 
search.php

# 
#-----[ FIND ]---------------------------------------------
# 
         'NEWEST_POST_IMG' => $newest_post_img, 

# 
#-----[ AFTER, ADD ]---------------------------------------
# 
         'TOPIC_ATTACHMENT_IMG' => topic_attachment_image_searchresults($searchset[$i]['topic_attachment']),

# 
#-----[ OPEN ]---------------------------------------------
# 
attach_mod/displaying.php

# 
#-----[ FIND ]---------------------------------------------
# 
	return $image;
}

# 
#-----[ AFTER, ADD ]---------------------------------------
# 
/**
* Returns the image-tag for the topic image icon in search results
*/
function topic_attachment_image_searchresults($switch_attachment)
{
	global $attach_config, $is_auth;

	if (intval($switch_attachment) == 0 || $is_auth['auth_view'] || intval($attach_config['disable_mod']) || $attach_config['topic_icon'] == '')
	{
		return '';
	}

	$image = '<img src="' . $attach_config['topic_icon'] . '" alt="" border="0" /> ';

	return $image;
}

# 
#-----[ OPEN ]---------------------------------------------
# 
templates/subSilver/search_results_topics.tpl

# 
#-----[ FIND ]---------------------------------------------
# 
   <td class="row2"><span class="topictitle">{searchresults.NEWEST_POST_IMG}{searchresults.TOPIC_TYPE}<a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a></span><br /><span class="gensmall">{searchresults.GOTO_PAGE}</span></td>

# 
#-----[ IN-LINE FIND ]---------------------------------------------
# around line 26 (directly in that line)
{searchresults.NEWEST_POST_IMG}

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------------
# 
{searchresults.TOPIC_ATTACHMENT_IMG}

Posted: Mon Apr 30, 2007 4:07 am
by Marcus Wendel
Thanks again, I'll give it a try.

/Marcus

Posted: Mon Apr 30, 2007 4:16 am
by Marcus Wendel
Looks great, many thanks for the help.

/Marcus