Template

Type
Class
Namespace
craft\helpers
Inherits
craft\helpers\Template
Since
3.0.0

Class Template

View source (opens new window)

# Public Methods

Method Description
beginProfile() Begins profiling a template element.
css() Registers a CSS file or a CSS code block.
endProfile() Finishes profiling a template element.
js() Registers a JS file or a JS code block.
paginateCriteria() Paginates a query.
paginateQuery() Paginates a query.
raw() Returns a string wrapped in a \Twig\Markup object
resolveTemplatePathAndLine() Attempts to resolve a compiled template file path and line number to its source template path and line number.

# beginProfile()

Since
3.3.0

Begins profiling a template element.

View source (opens new window)

Arguments

# css()

Since
3.5.6

Registers a CSS file or a CSS code block.

View source (opens new window)

Arguments

Throws

# endProfile()

Since
3.3.0

Finishes profiling a template element.

View source (opens new window)

Arguments

# js()

Since
3.5.6

Registers a JS file or a JS code block.

View source (opens new window)

Arguments

Throws

# paginateCriteria()

DEPRECATED

Deprecated in 3.6.0. Use paginateQuery() instead.

Paginates a query.

View source (opens new window)

Arguments

Returns

array (opens new window)

# paginateQuery()

Since
3.6.0

Paginates a query.

View source (opens new window)

Arguments

Returns

array (opens new window)

# raw()

Returns a string wrapped in a \Twig\Markup object

View source (opens new window)

Arguments

Returns

\Twig\Markup

# resolveTemplatePathAndLine()

Since
3.7.49

Attempts to resolve a compiled template file path and line number to its source template path and line number.

View source (opens new window)

Arguments

Returns

array (opens new window), false (opens new window) – The resolved template path and line number, or false if the path couldn’t be determined. If a template path could be determined but not the template line number, the line number will be null.

# Constants

Constant Description
PROFILE_STAGE_BEGIN
PROFILE_STAGE_END
PROFILE_TYPE_BLOCK
PROFILE_TYPE_MACRO
PROFILE_TYPE_TEMPLATE