Class View

Description

ThinkPHP 视图输出

支持缓存和页面压缩

Located in /Think/Core/View.class.php (line 25)

Base
   |
   --View
Variable Summary
mixed $trace
array $tVar
mixed $type
Method Summary
static Template getInstance ()
View __construct ([ $type = ''])
void assign (mixed $name, [mixed $value = ''])
boolen checkCache (string $tmplTemplateFile)
mixed display ([string $templateFile = ''], [string $charset = ''], [string $contentType = 'text/html'], [string $varPrefix = ''])
void fetch ([string $templateFile = ''], [string $charset = ''], [string $contentType = 'text/html'], [string $varPrefix = ''], [ $display = false], integer $mode)
mixed get (string $name)
void layout ( $layoutFile, [string $charset = ''], [string $contentType = 'text/html'], [string $varPrefix = ''], [string $display = true], string $layout)
string showTime (string $startTime)
void trace ( $title, [mixed $value = ''], mixed $name)
Variables
mixed $trace = array() (line 37)
  • access: protected
array $tVar = array() (line 35)

模板页面显示变量,未经定义的变量不会显示在页面中

  • access: protected
mixed $type = '' (line 40)
  • access: protected
Methods
static getInstance (line 51)

取得模板对象实例

  • access: public
static Template getInstance ()
Constructor __construct (line 56)
  • access: public
View __construct ([ $type = ''])
  • $type
assign (line 74)

模板变量赋值

  • access: public
void assign (mixed $name, [mixed $value = ''])
  • mixed $name
  • mixed $value
checkCache (line 251)

检查缓存文件是否有效

如果无效则需要重新编译

  • throws: ThinkExecption
  • access: protected
boolen checkCache (string $tmplTemplateFile)
  • string $tmplTemplateFile: 模板文件名
display (line 145)

加载模板和页面输出 可以返回输出内容

  • throws: ThinkExecption
  • access: public
mixed display ([string $templateFile = ''], [string $charset = ''], [string $contentType = 'text/html'], [string $varPrefix = ''])
  • string $templateFile: 模板文件名 留空为自动获取
  • string $charset: 模板输出字符集
  • string $contentType: 输出类型
  • string $varPrefix: 模板变量前缀
fetch (line 285)

加载模板和页面输出

  • throws: ThinkExecption
  • access: public
void fetch ([string $templateFile = ''], [string $charset = ''], [string $contentType = 'text/html'], [string $varPrefix = ''], [ $display = false], integer $mode)
  • string $templateFile: 模板文件名 留空为自动获取
  • string $charset: 模板输出字符集
  • string $contentType: 输出类型
  • string $varPrefix: 模板变量前缀
  • integer $mode: 0 返回 1 输出 2 下载
  • $display
get (line 113)

取得模板变量的值

  • throws: ThinkExecption
  • access: public
mixed get (string $name)
  • string $name
layout (line 212)

输出布局模板

  • access: public
void layout ( $layoutFile, [string $charset = ''], [string $contentType = 'text/html'], [string $varPrefix = ''], [string $display = true], string $layout)
  • string $layout: 指定要输出的布局模板
  • string $charset: 输出编码
  • string $contentType: 输出类型
  • string $varPrefix: 模板变量前缀
  • string $display: 是否直接显示
  • $layoutFile
showTime (line 163)

显示运行时间、数据库操作、缓存次数、内存使用信息

  • throws: ThinkExecption
  • access: protected
string showTime (string $startTime)
  • string $startTime: 开始时间
trace (line 92)

Trace变量赋值

  • access: public
void trace ( $title, [mixed $value = ''], mixed $name)
  • mixed $name
  • mixed $value
  • $title

Documentation generated on Thu, 27 Mar 2008 08:21:00 +0000 by 塞北的雪