PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   Mod Submissions (http://www.phpdig.net/forum/forumdisplay.php?f=24)
-   -   Display Document Icon in Result-page (http://www.phpdig.net/forum/showthread.php?t=1527)

Topaz 11-16-2004 02:03 PM

Display Document Icon in Result-page
 
Hi,

for those who may wont to display an icon if the search-result links to a binary document like word, pdf or anything else, I am adding here a small mod I inserted into "search_function.php" right after the line
Code:

$timer->stop('Extracts');
. Also these binaries will be opened in a new browser-window.

Code:

               
//binaries should display an image and be opened in a new window
$suffix_array = array('doc','pdf','xls','zip','ppt','pps');
$suffix = substr($url,-3);
if (in_array($suffix, $suffix_array)) {
  $mytarget = '_blank';
  $myimage = '<img src="icons/'.$suffix.'.gif" hspace="4">';
} else {
  $mytarget = LINK_TARGET;
  $myimage = '';
}

As you can see, I installed an "icons"-folder in the "search"-directory.

And I had to alter the code for the table_results array (just underneath). The value for "page_link" looks now

Code:

'page_link' => $myimage."<a class=\"phpdig\" href=\"".$url."\" onmousedown=\"return clickit(".$n.",'".$js_url."')\" target=\"".$mytarget."\" >".ereg_replace('%20*',' ',$title)."</a>",
According to this example the names of the icons should be like "pdf.gif" or "doc.gif".

Topaz


All times are GMT -8. The time now is 04:06 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.