PHP 클래스 Basecoat\View

저자: Brent Baisley ([email protected])
파일 보기 프로젝트 열기: shutterstock/basecoat 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$block_tag_regex @block_name
$blocks Content "blocks" in template files
$data Name/value pairing of data tags available to templates
$data_tags_delimiters Data tag delimiters
$default_namespace Namespace to place content in if none is specified
$enable_data_tags Enable data tag search and replace
$layout
$layouts Layout template to use
$templates_path

공개 메소드들

메소드 설명
__construct ( ) : Object Create an instance of the Content class
__get ( String $name ) : Mixed Getter method for returning a data item
__toString ( ) : String Return data values as string
add ( String $name, Mixed $content, boolean $append = true ) Add content under the namespace By default append to any existing data item with same namespace
addBlock ( String $block_name, String $content ) Add a content block under a specified namespace
addToView ( View $view ) : integer Merge content blocks for this instance with passed instance
clear ( ) Clear all content block namespaces and data
getBlocks ( ) : Array Get all currently parsed content blocks
getData ( ) : Array Get all the data currently loaded
getLayout ( $layout_name = null ) * Get the relative path to a layout file. Default is layout set with setLayout().
multiadd ( Array $name_vals, String $prefix = null ) Add multiple content under multiple namespaces Optionally provide a prefix to be prepended to each namespace name
parseBlocks ( String $tpl ) : integer Parse a template into content block namespaces if content block identifiers are present
processTemplate ( String $tpl, boolean $parse = true ) : String Load and process a content template, optionally parse content blocks into namespaces
replaceDataTags ( String &$tpl ) : String Search and replace data tags in templates Allows usage of {{:data}} tags to output data instead of having to use
setLayout ( $layout_name ) * Set the layout to use for output. Name must match one set with setLayouts().
setLayouts ( $layouts, $default = null ) * Load the list of layouts. An associative array where the key is the layout name and the value is the relative path to the layout file from the templates directory.
setTemplatesPath ( String $path ) Path to templates directory. Use as a prefix when referencing templates and layouts.
stripDataTags ( &$tpl )

메소드 상세

__construct() 공개 메소드

Create an instance of the Content class
public __construct ( ) : Object
리턴 Object instance of Content class

__get() 공개 메소드

Getter method for returning a data item
public __get ( String $name ) : Mixed
$name String Name of the data item to return
리턴 Mixed value of the data item

__toString() 공개 메소드

Return data values as string
public __toString ( ) : String
리턴 String values of data items delimited with line feeds

add() 공개 메소드

Add content under the namespace By default append to any existing data item with same namespace
public add ( String $name, Mixed $content, boolean $append = true )
$name String namespace to add content under
$content Mixed content to any under the namespace, can be any data structure
$append boolean whether or not to append the content to the namespace if namespace already exists

addBlock() 공개 메소드

Add a content block under a specified namespace
public addBlock ( String $block_name, String $content )
$block_name String namespace to add content block under
$content String content to add

addToView() 공개 메소드

Merge content blocks for this instance with passed instance
public addToView ( View $view ) : integer
$view View Instance to add content blocks to
리턴 integer number of content blocks merged

clear() 공개 메소드

Clear all content block namespaces and data
public clear ( )

getBlocks() 공개 메소드

Get all currently parsed content blocks
public getBlocks ( ) : Array
리턴 Array associative array of content blocks

getData() 공개 메소드

Get all the data currently loaded
public getData ( ) : Array
리턴 Array associative array of loaded data

getLayout() 공개 메소드

* Get the relative path to a layout file. Default is layout set with setLayout().
public getLayout ( $layout_name = null )
$layout_name name of layout

multiadd() 공개 메소드

Add multiple content under multiple namespaces Optionally provide a prefix to be prepended to each namespace name
public multiadd ( Array $name_vals, String $prefix = null )
$name_vals Array array of name/value pairs to add
$prefix String prefix to prepend to each namespace name

parseBlocks() 공개 메소드

Parse a template into content block namespaces if content block identifiers are present
public parseBlocks ( String $tpl ) : integer
$tpl String template to parse
리턴 integer number of content blocks discovered

processTemplate() 공개 메소드

Load and process a content template, optionally parse content blocks into namespaces
public processTemplate ( String $tpl, boolean $parse = true ) : String
$tpl String template file to include
$parse boolean whether to parse the template blocks into namespaces (default true)
리턴 String the processed template or the number of content blocks parsed

replaceDataTags() 공개 메소드

Search and replace data tags in templates Allows usage of {{:data}} tags to output data instead of having to use
public replaceDataTags ( String &$tpl ) : String
$tpl String template text to search and replace data tags on
리턴 String the processed template with data tags replaced

setLayout() 공개 메소드

* Set the layout to use for output. Name must match one set with setLayouts().
public setLayout ( $layout_name )
$layout_name name of layout

setLayouts() 공개 메소드

Optionally pass name of default layout.
public setLayouts ( $layouts, $default = null )
$layouts associative array of layouts names and relative paths
$default name of layout to set as default

setTemplatesPath() 공개 메소드

Path to templates directory. Use as a prefix when referencing templates and layouts.
public setTemplatesPath ( String $path )
$path String valid directory path

stripDataTags() 공개 메소드

public stripDataTags ( &$tpl )

프로퍼티 상세

$block_tag_regex 공개적으로 프로퍼티

@block_name
public $block_tag_regex

$blocks 공개적으로 프로퍼티

Content "blocks" in template files
public $blocks

$data 공개적으로 프로퍼티

Name/value pairing of data tags available to templates
public $data

$data_tags_delimiters 공개적으로 프로퍼티

Data tag delimiters
public $data_tags_delimiters

$default_namespace 공개적으로 프로퍼티

Namespace to place content in if none is specified
public $default_namespace

$enable_data_tags 공개적으로 프로퍼티

Enable data tag search and replace
public $enable_data_tags

$layout 공개적으로 프로퍼티

public $layout

$layouts 공개적으로 프로퍼티

Layout template to use
public $layouts

$templates_path 공개적으로 프로퍼티

public $templates_path