Class Parser

Summary

Fully Qualified Name: CodeIgniter\View\Parser
Extends: View

Description

Class Parser

ClassFormerlyKnownAsTemplateParser

Methods

Name Description Defined By
__construct() Constructor Parser
addPlugin() Makes a new plugin available during the parsing of the template. Parser
endSection() View
excerpt() Extract first bit of a long string and add ellipsis View
extend() Specifies that the current view should extend an existing layout. View
getData() Returns the current data that will be displayed in the view. View
getPerformanceData() Returns the performance data that might have been collected during the execution. Used primarily in the Debug Toolbar. View
include() Used within layout views to include additional views. View
insertNoparse() Re-inserts the noparsed contents back into the template. Parser
removePlugin() Removes a plugin from the available plugins. Parser
render() Parse a template Parser
renderSection() Renders a section's contents. View
renderString() Parse a String Parser
resetData() Removes all of the view data from the system. View
section() Starts holds content for a section within the layout. View
setData() Sets several pieces of view data at once. Parser
setDelimiters() Over-ride the substitution field delimiters. Parser
setVar() Sets a single piece of view data. View
shouldAddEscaping() Checks the placeholder the view provided to see if we need to provide any autoescaping. Parser

Method Details

__construct()

Constructor

Parameter Name Type Description
$config \Config\View
$viewPath string
$loader mixed
$debug bool
$logger \LoggerInterface

Returns:

addPlugin()

Makes a new plugin available during the parsing of the template.

Parameter Name Type Description
$alias string
$callback callable
$isPair bool

Returns: $this

endSection()

Returns:

excerpt()

Extract first bit of a long string and add ellipsis

Parameter Name Type Description
$string string
$length int

Returns: string

extend()

Specifies that the current view should extend an existing layout.

Parameter Name Type Description
$layout string

Returns: void

getData()

Returns the current data that will be displayed in the view.

Returns: array

getPerformanceData()

Returns the performance data that might have been collected during the execution. Used primarily in the Debug Toolbar.

Returns: array

include()

Used within layout views to include additional views.

Parameter Name Type Description
$view string
$options array|null
$saveData null

Returns: string

insertNoparse()

Re-inserts the noparsed contents back into the template.

Parameter Name Type Description
$template string

Returns: string

removePlugin()

Removes a plugin from the available plugins.

Parameter Name Type Description
$alias string

Returns: $this

render()

Parse a template

Parses pseudo-variables contained in the specified template view, replacing them with any data that has already been set.

Parameter Name Type Description
$view string
$options array
$saveData bool

Returns: string

renderSection()

Renders a section's contents.

Parameter Name Type Description
$sectionName string

Returns:

renderString()

Parse a String

Parses pseudo-variables contained in the specified string, replacing them with any data that has already been set.

Parameter Name Type Description
$template string
$options array
$saveData bool

Returns: string

resetData()

Removes all of the view data from the system.

Returns: \RendererInterface

section()

Starts holds content for a section within the layout.

Parameter Name Type Description
$name string

Returns:

setData()

Sets several pieces of view data at once.

In the Parser, we need to store the context here so that the variable is correctly handled within the parsing itself, and contexts (including raw) are respected.

Parameter Name Type Description
$data array
$context string The

Returns: \RendererInterface

setDelimiters()

Over-ride the substitution field delimiters.

Parameter Name Type Description
$leftDelimiter string
$rightDelimiter string

Returns: \RendererInterface

setVar()

Sets a single piece of view data.

Parameter Name Type Description
$name string
$value mixed
$context string The

Returns: \RendererInterface

shouldAddEscaping()

Checks the placeholder the view provided to see if we need to provide any autoescaping.

Parameter Name Type Description
$key string

Returns: bool|string

Top