Properties

$view

$view : \Think\view

视图实例对象

Type

\Think\view

$config

$config : \Think\config

控制器参数

Type

\Think\config

$_meta_title

$_meta_title : 

Type

$_top_button_list

$_top_button_list : 

Type

$_search

$_search : 

Type

$_tab_nav

$_tab_nav : 

Type

$_table_column_list

$_table_column_list : 

Type

$_table_data_list

$_table_data_list : 

Type

$_table_data_list_key

$_table_data_list_key : 

Type

$_table_data_page

$_table_data_page : 

Type

$_right_button_list

$_right_button_list : 

Type

$_alter_data_list

$_alter_data_list : 

Type

$_extra_html

$_extra_html : 

Type

$_template

$_template : 

Type

Methods

display()

display() : void

显示页面

__construct()

__construct() 

架构函数 取得模板对象实例

__set()

__set(  $name,   $value) 

Parameters

$name
$value

get()

get(string  $name = '') : mixed

取得模板显示变量的值

Parameters

string $name

模板显示变量

Returns

mixed

__get()

__get(  $name) 

Parameters

$name

__isset()

__isset(string  $name) : boolean

检测模板变量的值

Parameters

string $name

名称

Returns

boolean

__call()

__call(string  $method, array  $args) : mixed

魔术方法 有不存在的操作的时候执行

Parameters

string $method

方法名

array $args

参数

Returns

mixed

setMetaTitle()

setMetaTitle(  $meta_title) : $this

设置页面标题

Parameters

$meta_title

Returns

$this

addTopButton()

addTopButton(string  $type,   $attribute = null) : $this

加入一个列表顶部工具栏按钮 在使用预置的几种按钮时,比如我想改变新增按钮的名称 那么只需要$builder->addTopButton('add', array('title' => '换个马甲')) 如果想改变地址甚至新增一个属性用上面类似的定义方法

Parameters

string $type

按钮类型,主要有add/resume/forbid/recycle/restore/delete/self七几种取值

$attribute

Returns

$this

setSearch()

setSearch(  $title,   $url) : $this

设置搜索参数

Parameters

$title
$url

Returns

$this

setTabNav()

setTabNav(  $tab_list,   $current_tab) : $this

设置Tab按钮列表

Parameters

$tab_list

Tab列表 array( 'title' => '标题', 'href' => 'http://www.corethink.cn' )

$current_tab

当前tab

Returns

$this

addTableColumn()

addTableColumn(  $name,   $title,   $type = null,   $param = null) 

加一个表格标题字段

Parameters

$name
$title
$type
$param

setTableDataList()

setTableDataList(  $table_data_list) 

表格数据列表

Parameters

$table_data_list

setTableDataListKey()

setTableDataListKey(  $table_data_list_key) 

表格数据列表的主键名称

Parameters

$table_data_list_key

addRightButton()

addRightButton(string  $type,   $attribute = null) : $this

加入一个数据列表右侧按钮 在使用预置的几种按钮时,比如我想改变编辑按钮的名称 那么只需要$builder->addRightpButton('edit', array('title' => '换个马甲')) 如果想改变地址甚至新增一个属性用上面类似的定义方法 因为添加右侧按钮的时候你并没有办法知道数据ID,于是我们采用__data_id__作为约定的标记 __data_id__会在display方法里自动替换成数据的真实ID

Parameters

string $type

按钮类型,edit/forbid/recycle/restore/delete/self六种取值

$attribute

Returns

$this

setTableDataPage()

setTableDataPage(  $table_data_page) : $this

设置分页

Parameters

$table_data_page

Returns

$this

alterTableData()

alterTableData(  $condition,   $alter_data) : $this

修改列表数据 有时候列表数据需要在最终输出前做一次小的修改 比如管理员列表ID为1的超级管理员右侧编辑按钮不显示删除

Parameters

$condition
$alter_data

Returns

$this

setExtraHtml()

setExtraHtml(  $extra_html) : $this

设置额外功能代码

Parameters

$extra_html

额外功能代码

Returns

$this

setTemplate()

setTemplate(  $template) : $this

设置页面模版

Parameters

$template

模版

Returns

$this

show()

show(string  $content, string  $charset = '', string  $contentType = '', string  $prefix = '') : mixed

输出内容文本可以包括Html 并支持内容解析

Parameters

string $content

输出内容

string $charset

模板输出字符集

string $contentType

输出类型

string $prefix

模板缓存前缀

Returns

mixed

fetch()

fetch(string  $templateFile = '', string  $content = '', string  $prefix = '') : string

获取输出页面内容 调用内置的模板引擎fetch方法,

Parameters

string $templateFile

指定要调用的模板文件 默认为空 由系统自动定位模板文件

string $content

模板输出内容

string $prefix

模板缓存前缀*

Returns

string

theme()

theme(string  $theme) : \Think\Action

模板主题设置

Parameters

string $theme

模版主题

Returns

\Think\Action

assign()

assign(mixed  $name, mixed  $value = '') : \Think\Action

模板变量赋值

Parameters

mixed $name

要显示的模板变量

mixed $value

变量的值

Returns

\Think\Action

error()

error(string  $message = '', string  $jumpUrl = '', mixed  $ajax = false) : void

操作错误跳转的快捷方法

Parameters

string $message

错误信息

string $jumpUrl

页面跳转地址

mixed $ajax

是否为Ajax方式 当数字时指定跳转时间

success()

success(string  $message = '', string  $jumpUrl = '', mixed  $ajax = false) : void

操作成功跳转的快捷方法

Parameters

string $message

提示信息

string $jumpUrl

页面跳转地址

mixed $ajax

是否为Ajax方式 当数字时指定跳转时间

ajaxReturn()

ajaxReturn(mixed  $data, String  $type = '', integer  $json_option) : void

Ajax方式返回数据到客户端

Parameters

mixed $data

要返回的数据

String $type

AJAX返回数据格式

integer $json_option

传递给json_encode的option参数

redirect()

redirect(string  $url, array  $params = array(), integer  $delay, string  $msg = '') : void

Action跳转(URL重定向) 支持指定模块和延时跳转

Parameters

string $url

跳转的URL表达式

array $params

其它URL参数

integer $delay

延时跳转的时间 单位为秒

string $msg

跳转提示信息

_initialize()

_initialize() : $this

初始化方法

Returns

$this

compileHtmlAttr()

compileHtmlAttr(  $attr) 

Parameters

$attr

formatBytes()

formatBytes(\Common\Builder\number  $size, string  $delimiter = '') : string

格式化字节大小

Parameters

\Common\Builder\number $size

字节数

string $delimiter

数字和单位分隔符

Returns

string —

格式化后的带单位的大小

dispatchJump()

dispatchJump(string  $message, Boolean  $status = 1, string  $jumpUrl = '', mixed  $ajax = false) : void

默认跳转操作 支持错误导向和正确跳转 调用模板显示 默认为public目录下面的success页面 提示页面为可配置 支持模板标签

Parameters

string $message

提示信息

Boolean $status

状态

string $jumpUrl

页面跳转地址

mixed $ajax

是否为Ajax方式 当数字时指定跳转时间