<?php
if (!defined('ROOT_PATH')) { exit('Access Denied'); }
require_once __DIR__ . '/_functions.php';
$keyword = trim((string) (isset($_GET['keyword']) ? $_GET['keyword'] : ''));
$items = array();
foreach (array('product', 'article', 'image', 'download', 'video', 'recruit') as $routeName) {
    if ($keyword === '') { continue; }
    foreach (tpl_query_items($routeName, 0, 20, 1, $keyword)['items'] as $row) {
        $row['_route'] = $routeName;
        $items[] = $row;
    }
}
$tplNavKey = 'home';
$seoTitle = '搜索结果';
$bodyClass = 'k620-inner-page';
require_once __DIR__ . '/_header.php';
tpl_inner_banner('搜索结果', 'search');
?>
<main class="NyNews"><div class="NyNews_Main"><div class="k620-search-title">搜索关键词：<span><?php echo tpl_e($keyword); ?></span></div><div class="NyNews_List"><ul class="newul">
    <?php foreach ($items as $item): ?><li><div class="new_box"><p><a href="<?php echo tpl_e(tpl_item_url($item['_route'], $item)); ?>"><?php echo tpl_e($item['title']); ?></a></p><em><?php echo date('Y-m-d', tpl_row_time($item)); ?></em><span><?php echo tpl_e(tpl_text(isset($item['summary']) && $item['summary'] !== '' ? $item['summary'] : (isset($item['content']) ? $item['content'] : ''), 190)); ?></span></div></li><?php endforeach; ?>
    <?php if (!$items): ?><li class="cms-empty"><?php echo $keyword === '' ? '请输入要查询的关键词' : '暂无匹配内容，请更换关键词'; ?></li><?php endif; ?>
</ul></div><div class="clear"></div></div></main>
<?php require_once __DIR__ . '/_footer.php'; ?>
