Location: PHPKode > scripts > Linker IMG > linker-img/topkword.php
<?php

//=====================================
// LINKER Category Engine
//=====================================
// Filename : tkword.php
// Path  : Main directory
// last update : 2002/05/6
// Desc : View cool search keyword
//=====================================

//=====================================
// Info File include
//=====================================

$time1 = microtime();
include ("./function/base_info.php");
include ("./function/main_func.php");
include ("./function/$Sdb_type.php");
include ("./function/template.php");

$lan_dir = $HTTP_COOKIE_VARS[cook_lan];
if ($lan_dir && file_exists("./$lan_dir/u_common.php")) 
include ("./$lan_dir/u_common.php"); 
else include ("./$Slang/u_common.php"); 

//=====================================
// DB_LAYER / TEMPLATE
//=====================================

$db = new DB_Sql($Sdb_host,$Sdb_user,$Sdb_pass,$Sselect_db);
$tpl = new Stemplate($Stemplate);

$tpl->define(	array( topkword      => "topkword.html" ));
$tpl->dyn_define ( "tdcol", "topkword" );

$tpl->assign(array(

TEMPLATE	=> $Stemplate,
DOMAIN			=> $Sdomain,
CHARSET		=> $Scharset,
BGCOLOR		=> $Sbgcolor,
MWIDTH			=> $Smain_width,
ALIGN			=> $Salign,
L_TKWORD	=> $l_tkword,
L_SEARCH_NUM => $l_search_num,
L_SEARCH_WORD => $l_search_word,
PAGE_HEADER  => implode("",file("$Stemplate/header.html")),
PAGE_FOOTER  => implode("",file("$Stemplate/footer.html")),
));


//=====================================
// Make Output
//=====================================



$db->query("select count(kword) as count,kword from LINKER_TWORD 
group by kword order by count desc,kword limit $Stopkword");

$limit_num = ceil($db->numrow / 2 );

while ($row = $db->nrecord()) {
$ordernum++;
	if ($limit_num >= $ordernum) 	{
	$temp_array[$ordernum][tcount1] = $row[count];
	$temp_array[$ordernum][tkword1] = htmlspecial($row[kword]);
	$temp_array[$ordernum][ordernum1] = $ordernum;
	}
	else 
	{
	$tempnum = $ordernum - $limit_num;
	$temp_array[$tempnum][tcount2] = $row[count];
	$temp_array[$tempnum][tkword2] = htmlspecial($row[kword]);
	$temp_array[$tempnum][ordernum2] = $ordernum;
	}
}

for ($i=1;$i <= count($temp_array) ;$i++) {

$tpl->assign(array( 
T_COUNT1		=> $temp_array[$i][tcount1],
T_KWORD1		=> $temp_array[$i][tkword1],
T_EKWORD1	=> urlencode($temp_array[$i][tkword1]),
OR_NUM1		=> $temp_array[$i][ordernum1],
T_COUNT2		=> $temp_array[$i][tcount2],
T_KWORD2		=> $temp_array[$i][tkword2],
T_EKWORD2	=> urlencode($temp_array[$i][tkword2]),
OR_NUM2		=> $temp_array[$i][ordernum2]
));
$tpl->parse("TROW",".tdcol");

}


show_menu();
show_here("","","$l_tkword TOP $Stopkword");
show_search();

$tpl->parse(MAIN, "topkword");
$tpl->simprint("MAIN");

//====================================
// Establish Time
//====================================

if ($Stime == "Y") check_time($time1);
?>
Return current item: Linker IMG