Example #1
0
$left_zhuyings = $db->query("select * from cn_business_type where parent_id=2 order by sort asc");
$left_zhuying = array();
while ($row = $db->fetch($left_zhuyings)) {
    $left_zhuying[] = $row;
}
$smarty->assign('left_zhuying', $left_zhuying);
$sleft_yanshen = $db->query("select * from cn_business_type where parent_id=3 order by sort asc");
$left_yanshen = array();
while ($row = $db->fetch($sleft_yanshen)) {
    $left_yanshen[] = $row;
}
$smarty->assign('left_yanshen', $left_yanshen);
//安全管理
$left_zhi = $db->fetch($db->query("select * from cn_safety_type where id=2 "));
$smarty->assign('left_zhi', $left_zhi);
$left_bai = $db->fetch($db->query("select * from cn_safety_type where id=3 "));
$smarty->assign('left_bai', $left_bai);
$sleft_bai = alla("cn_safety_type", " and parent_id=3", "order by sort asc");
$smarty->assign('sleft_bai', $sleft_bai);
//面包屑导航-员工风采
$whatid = empty($_GET["whatid"]) ? '' : $_GET["whatid"];
$staff_name = '';
if ($whatid != '') {
    $staff_name = $db->fetch($db->query("select * from cn_staff_type where id={$whatid}"));
} else {
    $staff_name = $db->fetch($db->query("select * from cn_staff_type where id=1"));
}
$smarty->assign('staff_name', $staff_name);
//友情链接
$footurl = alla('cn_along', ' and type_id=3', ' order by sort asc');
$smarty->assign('footurl', $footurl);
Example #2
0
// 计算中文字符串长度
function utf8_strlen($string = null)
{
    // 将字符串分解为单元
    preg_match_all("/./us", $string, $match);
    // 返回单元个数
    return count($match[0]);
}
/*
 * 判断客户端用什么设备访问网站
 * */
$nowuser = '';
if (isset($_SESSION['user']['username']) && !empty($_SESSION['user']['username'])) {
    $nowuser = $_SESSION['user']['username'];
}
$smarty->assign('nowuser', $nowuser);
//////////////////////////////////////////////////////////////////////////////
//新闻
$news_type = alla("cn_news_type", " and parent_id=0", " order by sort asc");
$smarty->assign("news_type", $news_type);
//主题
$theme_type = alla("cn_theme_type", " and parent_id=0", " order by sort asc");
$smarty->assign("theme_type", $theme_type);
//公开引导课
$course_type = alla("cn_course_type", " and parent_id=0", " order by sort asc");
$smarty->assign("course_type", $course_type);
//往期时间计算 往期3个月
$date = date("Y-m-d", time() - 60 * 60 * 24 * 30 * 3);
//Banner图
$Banner = alla("cn_along", " and type_id=1 and guishu='index'", " order by sort asc");
$smarty->assign("banner", $Banner);