PDA

View Full Version : a more google approach


bthurlow
10-06-2003, 12:03 AM
Hey all, I have made some modifications to my phpdig search. Some of you will like some will not.

I had some problems with the highlighting of the search terms so i had to make a workaround that i have implemented. Also, I wanted a more google styled look to my search engine. To accomplish this i again did some coding. Granted most of this is a rough version it is throughly tested for stability. Below is the files and the coding changes to them. Maybe this will even make it into the next version. If you all would like to include this functionality just let me know and i'll make a more user friendly configuration.

Code & Files.

Add the following to config.php just before the default values.

//Remove variable to not use functionality
define('HIGHLIGHT','<b><font color="blue">'); //Highlight for non classic mode or if above highlight does not work
define('IMG_NAV_START_NOPREV','<img src="./tpl_img/d-nav.gif"/><img src="./tpl_img/r-nav.gif"/>'); //Image for beggining of Nav Bar w/o previous message
define('IMG_NAV_START_PREV','<img src="./tpl_img/r-nav.gif" border=0 align="right"/><img src="./tpl_img/d-nav.gif" border=0 align="right"/><br><br>'); //Image for beggining of Nav Bar w/ previous message
define('IMG_NAV_PAGE_NOSEL','<img src="./tpl_img/a-nav.gif" border=0><br><br>'); //Image for noncurrent nav bar page
define('IMG_NAV_PAGE_SEL','<img src="./tpl_img/a-nav-sel.gif"><br><br>'); //Image for current nav bar page
define('IMG_NAV_END_NONEXT','<img src="./tpl_img/c-nav.gif" align="left"/><img src="./tpl_img/o-nav.gif" align="left"/>'); //Image for end of nav bar w/o next message
define('IMG_NAV_END_NEXT','<img src="./tpl_img/c-nav.gif" border=0 align="left"/><img src="./tpl_img/o-nav.gif" border=0 align="left"/><br><br>'); //Image for end of nav bar w/ next message

Replace Line 150 in your phpdig_functions.php file with this:
return @eregi_replace($ereg,'\\1<span class=\"phpdigHighlight\">'.HIGHLIGHT.'\\2</b></font></span>\\3',$string);

In search_function.php replace lines 346 - 369 with the following.

if ($lim_start > 0) {
$previous_link = $url_bar.($lim_start-$limite);
$nav_bar .= '<td><a class=\"phpdig\" href="'.$previous_link.'" >'.IMG_NAV_START_PREV.'<center>&lt;&lt;'.phpdigMsg("previous").'</a></td>';
}
else{
$nav_bar .= '<td valign="top">'.IMG_NAV_START_NOPREV.'</td>';
}
$tot_pages = ceil($num_tot/$limite);
$actual_page = $lim_start/$limite + 1;
$page_inf = max(1,$actual_page - 5);
$page_sup = min($tot_pages,max($actual_page+5,10));
for ($page = $page_inf; $page <= $page_sup; $page++) {
if ($page == $actual_page) {

$nav_bar .= ' <td><span class=\"phpdigHighlight\">'.IMG_NAV_PAGE_SEL.HIGHLIGHT.$page.'</font></span></img></td>';
$pages_bar .=' <td><span class=\"phpdigHighlight\">'.HIGHLIGHT.$page.'</font></span></td>';
$link_actual = $url_bar.(($page-1)*$limite);
}
else {
$nav_bar .= '<td><a class=\"phpdig\" href="'.$url_bar.(($page-1)*$limite).'" >'.IMG_NAV_PAGE_NOSEL.$page.'</a></td>';
$pages_bar .= "<td><a class=\"phpdig\" href=\"".$url_bar.(($page-1)*$limite)."\" >$page</a> \n</td>";
}
}

if ($more_results == 1) {
$next_link = $url_bar.($lim_start+$limite);
$nav_bar .= '<td><a class=\"phpdig\" href="'.$next_link.'" >'.IMG_NAV_END_NEXT.'<center>'.phpdigMsg("next").'&gt;&gt;</a></td>';
}
else{
$nav_bar .= '<td valign="top">'.IMG_NAV_END_NONEXT.'</td>';
}

if you would like to comment on these modifications please feel free to do so. Hopefully some of you will find this interesting and usefull.

Sincerely,
Thurlow

bthurlow
10-06-2003, 02:34 AM
Just ignore everything above.

If you would like. I have finished the changes because i was bored. The attached file includes all changes that i made including a readme file.

Have fun and let me know what you think.

If you would like to see a working version of the changes click below

Thurlow Designs Search Engine (http://thurlowdesigns.no-ip.com/search/index.php)

Have a good day.:D :cool:

bthurlow
10-08-2003, 12:14 PM
The attached file is the current exsisting templates that i have modified to work with the above layout changes of phpdig. If you decide to install the above changes, please feel free to install these templates for plug and play operation.

Have fun with PhpDig everyone.

Rolandks
10-08-2003, 01:34 PM
Nice Idea, but i think the Layout is unclearly to read.
The Distance between the results is to small, and big Lines in "limit to...." break or wrap. AND < end of virtual header of page > HTML-Comments are indexed .... see this: bug:http://www.phpdig.net/showthread.php?s=&threadid=85

bthurlow
10-08-2003, 08:23 PM
Thanks Roland, i see what you are talking about. All i'll have to do is just work on the html for the formatting of the results and the limit to...... I'll get to work on the format of the templates and check all of them for those errors. Right now I'm just focusing on layout of the results and more flexability of the format of the layout. I'll Contribute here first and then i'll start contributing on some of the hardcore coding. Just trying to contribute in some form or another.