function listCategory($blog_id) { if ($cates = App\Blog::find($blog_id)->cateRelation) { $ret = '<ul style="list-style:none;" class="clearfix">' . "\n"; foreach ($cates as $cate) { $cateObj = App\Cate::find($cate->cate_id); $ret .= '<li class="pull-left">'; $ret .= '<a href="' . getUrl("blog/category/" . $cateObj->slug) . '">' . $cateObj->c_name . '</a>'; $ret .= '</li>' . "\n"; } $ret .= '</ul>' . "\n"; return $ret; } else { return ''; } }