Location: PHPKode > projects > Content*Builder > modules/searchbox/searchBoxResults.php
<?php
	
	/* new 2004/03: Set standard Article-Management to multilanguage module ... */
	if (! $artType ) { $artType = "article2"; }
	
	$searchStringArray = explode(" AND ", $searchString);
	$where = "(( ";
	$c = 0;
	foreach($searchStringArray as $key => $value) {
		if($c > 0) { $where .= " AND "; }
		$where .= "c.content LIKE '%".$value."%' ";
	}
	$where .= " ) OR (";
	$c = 0;
	foreach($searchStringArray as $key => $value) {
		if($c > 0) { $where .= " AND "; }
		$where .= "c.intro LIKE '%".$value."%' ";
	}
	$where .= " ) OR (";
	$c = 0;
	foreach($searchStringArray as $key => $value) {
		if($c > 0) { $where .= " AND "; }
		$where .= "c.title LIKE '%".$value."%' ";
	}
	$where .= " ))";
	
	$sBoxResult = false;
/* Implementation of stage rules in module article */
	if ( ! $today ) { $today = date( "Ymd", time() ); }
	
	if ( $artType == "article2" ) {
		$dateStatement = ($cbOption->getSingleOption("timepost")) ? " AND g.publishfrom <= '$today' AND (g.publishto >= '$today' OR (0+g.publishto = 0)) " : "";
		$sqlSearchQuery =  "SELECT c.ide, c.language, c.title, g.datetime AS datum, g.folderID as folder, substring(c.content, 1, 3) as content_0_3 FROM ".TABLE."_art_content AS c, ".TABLE."_art_general AS g ";
		$sqlSearchQuery .= " where c.ide = g.ide AND g.stage = '3' $dateStatement";
		$sqlSearchQuery .= " and " . $where;
		$sqlSearchQuery .= "  ORDER BY g.datetime DESC";
	} else {
		$dateStatement = ($cbOption->getSingleOption("timepost")) ? " AND c.publishfrom <= '$today' AND (c.publishto >= '$today' OR (0+c.publishto = 0)) " : "";
		$sqlSearchQuery = "SELECT c.title, c.ide, c.datum, c.userid, c.stage, c.folder FROM ".TABLE."_article c ";
		$sqlSearchQuery .= " where c.stage = '3' $dateStatement";
		$sqlSearchQuery .= " and " . $where;
		$sqlSearchQuery .= "  ORDER BY c.datum DESC";
	}
	$searchBoxQuery = mysql_query($sqlSearchQuery );
	
	$resultCounter = 0;
	while($result = mysql_fetch_object($searchBoxQuery)){
		$sBoxIDE[]    = $result->ide;
		$sBoxFolder[] = $result->folder;
		$sBoxTitle[]  = $result->title;
		$sBoxDate[]   = $result->datum;
		$sBox_na_flag[] = $result->content_0_3;
		$sBoxResult  = true;
		$resultCounter++;
		if ($resultCounter >100) break;
	} // while
	
	$tpl->assign("resultCount", $resultCounter);
	$tpl->assign("ARTTYPE", $artType);
	
	$tpl->assign("sboxresults_row",
		array(  "DATE_ADD" => $sBoxDate,
				"TITLE"    => $sBoxTitle,
				"FOLDER"   => $sBoxFolder,
				"IDE"      => $sBoxIDE,
				"NA_FLAG"  => $sBox_na_flag
		)
	);
	
	$tpl->assign("searchTemplate", 2); 
	$tpl->display("searchBox.template");
?>
Return current item: Content*Builder