当前位置:   article > 正文

【代码段】动态生成页面heading_$adrethya@@remoya@@rnpoya@@aw@yp@ot@lo

$adrethya@@remoya@@rnpoya@@aw@yp@ot@lo
  1. /**
  2. * 生成页面Heading
  3. *
  4. * @param string $path 指定的path
  5. * @return string
  6. */
  7. function build_heading($path = null, $container = true)
  8. {
  9. $title = $content = '';
  10. if (is_null($path)) {
  11. $action = request()->action();
  12. $controller = str_replace('.', '/', request()->controller());
  13. $path = strtolower($controller . ($action && $action != 'index' ? '/' . $action : ''));
  14. }
  15. // 根据当前的URI自动匹配父节点的标题和备注
  16. $data = Db::name('auth_rule')->where('name', $path)->field('title,remark')->find();
  17. if ($data) {
  18. $title = __($data['title']);
  19. $content = __($data['remark']);
  20. }
  21. if (!$content) {
  22. return '';
  23. }
  24. $result = '<div class="panel-lead"><em>' . $title . '</em>' . $content . '</div>';
  25. if ($container) {
  26. $result = '<div class="panel-heading">' . $result . '</div>';
  27. }
  28. return $result;
  29. }

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号