function aside_html() { $lecture_inc = new LectureClass(); $recent = $lecture_inc->get_recent_list(); if ($recent == false) { return ' <h4 class="font-thin">本期讲座</h4> <section class="panel panel-default"> <section class="panel-body text-center" style="padding-top:50px; padding-bottom:50px"> <strong>近期无讲座</strong> </section> </section> '; } else { $taglist = json_decode($recent[0]["tag"]); $taghtml = ""; foreach ($taglist->tag as $tag) { $taghtml .= '<label class="label label-info" style="margin-right: 5px;">' . $tag . '</label>'; } return ' <h4 class="font-thin">本期讲座</h4> <section class="panel panel-default"> <section class="panel-body"> <h3 style="margin-top: 5px">' . $recent[0]["title"] . '</h3> <hr> <ul style="list-style:none; margin:0; padding:0"> <li style="padding-bottom: 10px;"> <i class="fa fa-user" style="width: 2em; text-align:center; margin-right: 10px"></i> <span>' . $recent[0]["lecture_author"] . '</span> </li> <li style="padding-bottom: 10px;"> <i class="fa fa-clock-o" style="width: 2em; text-align:center; margin-right: 10px"></i> <span>' . $recent[0]["time"] . '</span> </li> <li style="padding-bottom: 10px;"> <i class="fa fa-map-marker" style="width: 2em; text-align:center; margin-right: 10px"></i> <span>' . $recent[0]["location"] . '</span> </li> <li style="padding-bottom: 15px;"> <i class="fa fa-tags" style="width: 2em; text-align:center; margin-right: 10px"></i> <span>' . $taghtml . '</span> </li> <li class="text-right"> <a href="app/lecture/index.php?lid=' . $recent[0]["lid"] . '">查看详情>></a> </li> </ul> </section> </section> '; } }
<?php require_once dirname(dirname(dirname(__FILE__))) . '/init.php'; require_once dirname(__FILE__) . "/includes/lecture.class.php"; $lecture_inc = new LectureClass(); $smarty->assign('recent_lecture', $lecture_inc->get_recent_list()); $smarty->assign('pass_lecture', $lecture_inc->get_pass_list()); $smarty->assign('my_lecture', $lecture_inc->get_my_list($login_uid)); $smarty->display(dirname(__FILE__) . '/templates/index.tpl');