魔众积分商城系统视图内置变量说明

魔众积分商城系统 / 文档中心
文档中心
开发教程
安装常见问题

_viewFrame 框架视图文件

通过会在 blade 模板文件中看到 @extends($_viewFrame) 来确定当前模板的框架视图,该文件通常包含公共的头部、尾部、侧边栏等内容。

$_viewFrame 会根据当前模板查找最先匹配到的文件,查找顺序参考视图渲染查找顺序

通常情况下,该变量会按照如下顺序查找:

  1. 当前主题视图根目录的框架视图文件,可能为以下路径中的一个
    • resources/views/theme/<主题>/pc/frame.blade.php
    • module/<主题模块>/View/pc/frame.blade.php
  2. 如果主题未定义框架视图文件,会使用系统默认视图目录
    • resources/views/theme/default/pc/frame.blade.php

常见 @section 说明

系统约定了一些模板 @section ,在开发时候请遵守约定,以便系统能够正确的渲染模板。

  • @section('pageTitleMain'):系统标题,该标题后会自动补全网站主名称
  • @section('pageKeywords'):网站关键字
  • @section('pageDescription'):网站描述
  • @section('bodyContent'):系统正文内容部分,不包含公共的头部、尾部、侧边栏等内容
  • @section('body'):系统 body 标签的内容,会自动移除 body 标签中已有的内容
  • @section('headAppend'):追加到 head 标签的内容
  • @section('bodyAppend'):追加到 body 标签的内容

以上的 section 定义用法示例如下

@section('pageTitleMain')我的视图标题@endsection
@section('pageKeywords')我的视图关键字@endsection
@section('pageDescription')我的视图描述@endsection
@section('bodyContent')
    <div class="ub-container">
        我的视图内容
    </div>
@endsection
@section('body')
    <div class="ub-container">
        我的视图内容
    </div>
@endsection
@section('headAppend')
        
    <script src="xxx"></script>
@endsection
@section('bodyAppend')
        
    <script src="xxx"></script>
@endsection
QQ
微信
公众号