![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
<?
include('../include/News.php');
include('../include/TurnPage.php');
include('../include/SwitchKind.php');
$news = new News();
$lines = 20;
if (strlen($keyword) > 0)
{
$cond = "where (title like binary '%$keyword%') or (body like binary '%$keyword%')";
}
else
{
if (strlen($kind) > 0)
$cond = "where kind ='$kind' order by id desc";
else
$cond = "order by id desc";
}
$tp = new TurnPage('zjdy' , "select * from news ".$cond, $page, $lines,
"index.php", "kind=$kind&keyword=$keyword");
$cond = $cond.$tp->getCurLimit();
$l = $news->getElements($cond);
$l2 = $news->getElements("order by id desc limit 0 ,5");
$t = new Tpl();
$t->set_file('index', 'index.tpl');
$t->set_block('index', 'row', 'rows');
for ($i=0; $i<$l->getSize(); $i++)
{
$item = $l->getAt($i);
$t->set_var('id', $item[0]);
$t->set_var('title', $item[1]);
$t->set_var('picture', $item[3]);
$t->set_var('update_time', substr($item[4],0,10));
$nowtime = time();
$strtotime = strtotime($update_time);
$days = "1";
$dayseconds = "86400";
$iii = "$days*$dayseconds";
$ttt = "$nowtime-$strtotime";
if($ttt<$iii)
{
$t->set_var('new', '[New]');
}
$t->parse('rows', 'row', true);
}
$t->set_block('index', 'top10', 'top10s');
for ($i = 0; $i<$l2->getSize(); $i++)
{
$item = $l2->getAt($i);
$t->set_var('top10_id', $item[0]);
$t->set_var('top10_title', $item[1]);
$t->parse('top10s', 'top10', true);
}
$l3 = $news->getElements("order by comment_nums desc limit 0 ,5");
$t->set_block('index', 'top20', 'top20s');
for ($i = 0; $i<$l3->getSize(); $i++)
{
$item = $l3->getAt($i);
$t->set_var('top20_id', $item[0]);
$t->set_var('top20_title', $item[1]);
$t->parse('top20s', 'top20', true);
}
$t->set_var('tmp_kind',SwitchKind($kind));
$t->set_var('kind',$kind);
$t->set_var('first',$tp->getFirst());
$t->set_var('pre',$tp->getPre());
$t->set_var('next',$tp->getNext());
$t->set_var('last',$tp->getLast());
$t->set_var('page',$tp->getPage());
$t->set_var('pages',$tp->getPages());
$t->set_var('count', $tp->getCount());
$t->parse('out', 'index');
$t->p('out');
?>
现在要加上如果KIND=16,则输出有图片的,
怎么做啊,帮我改改啊,谢谢

