$items) {
foreach($kws as $kw) {
foreach($items['text'] as $k => $text) {
if(strpos(strtolower($text), strtolower($kw)) !== FALSE) {
$result[$skey][] = $k;
}
}
}
}
if($result) {
$totalcount = 0;
foreach($result as $skey => $tkeys) {
$tmp = array();
foreach($searchindex[$skey]['index'] as $title => $url) {
if($title{0} != '_') {
$tmp[] = ''.$title.'';
}
}
$texts = array();
$tkeys = array_unique($tkeys);
foreach($tkeys as $tkey) {
if(isset($lang[$searchindex[$skey]['text'][$tkey]])) {
$texts[] = '
'.strip_tags($lang[$searchindex[$skey]['text'][$tkey]]).'('.$searchindex[$skey]['text'][$tkey].')';
} else {
$texts[] = ''.$searchindex[$skey]['text'][$tkey].'';
}
}
$texts = array_unique($texts);
$texts = implode('', $texts);
$totalcount += $count = count($tkeys);
$html[] = ''.cplang('search_result_item', array('number' => $count)).''.implode(' » ', $tmp).'
';
}
if($totalcount) {
showsubmenu('search_result', array(), ''.cplang('search_result_find', array('number' => $totalcount)).'');
echo implode('
', $html);
hlkws($kws);
} else {
cpmsg('search_result_noexists', '', 'error');
}
} else {
cpmsg('search_result_noexists', '', 'error');
}
} else {
cpmsg('search_keyword_noexists', '', 'error');
}
function hlkws($kws) {
echo <<
_attachEvent(window, 'load', function () {
EOF;
foreach($kws as $kw) {
echo 'parsetag(\''.$kw.'\');';
}
echo '}, document)';
}
?>