= 3) { // must be longer or equal to 3 characters ! $query = "SELECT id,title,e.description,url,cat,cat_name,day,month,year, color FROM ".$CONFIG['TABLE_EVENTS']." AS e LEFT JOIN ".$CONFIG['TABLE_CATEGORIES']." AS c ON e.cat=c.cat_id "; $query .= "WHERE (title LIKE '%$search%' OR e.description LIKE '%$search%') AND c.enabled = '1' AND approved = '1' "; $query .= "ORDER BY year ASC, month ASC, day ASC"; $result = db_query($query); $num_rows = db_num_rows($result); $count = 0; while ($row = db_fetch_object($result)) { $title = format_text($row->title,false,true); $search_results[$count]['search_title'] = highlight($search,$title,"",""); # popup or not ? if ($CONFIG['popup_event_mode']){ $search_results[$count]['search_link'] = "href=\"#\" onclick=\"MM_openBrWindow('cal_popup.php?mode=view&id=".$row->id."','Calendar','toolbar=no,location=no,"; $search_results[$count]['search_link'] .= "status=no,menubar=no,scrollbars=yes,resizable=no',".$CONFIG['popup_event_width'].",".$CONFIG['popup_event_height'].",false)\""; } else $search_results[$count]['search_link'] = "href='calendar.php?mode=view&id=".$row->id."'"; $description = process_content(format_text(sub_string($row->description,100,"..."),false,false)); $search_results[$count]['search_desc'] = highlight($search,$description,"",""); $search_results[$count]['cat_id'] = $row->cat; $search_results[$count]['cat_name'] = $row->cat_name; $search_results[$count]['date'] = strftime ($lang_date_format['day_month_year'], mktime(12,0,0,$row->month,$row->day,$row->year)); $count++; } } } theme_search_results($search_results, $num_rows); // footer pagefooter(); ?>