Packages

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • NBaseTemplate
  • NCachingHelper
  • NCurlyBracketsMacros
  • NLatteFilter
  • NLatteMacros
  • NSnippetHelper
  • NTemplate
  • NTemplateCacheStorage
  • NTemplateFilters
  • NTemplateHelpers

Interfaces

  • IFileTemplate
  • ITemplate
  • Overview
  • Package
  • Class
  • Tree
  • Other releases

Class NLatteMacros

Default macros for filter LatteFilter.

  • {$variable} with escaping
  • {!$variable} without escaping
  • {*comment*} will be removed
  • {=expression} echo with escaping
  • {!=expression} echo without escaping
  • {?expression} evaluate PHP statement
  • {_expression} echo translation with escaping
  • {!_expression} echo translation without escaping
  • {link destination ...} control link
  • {plink destination ...} presenter link
  • {if ?} ... {elseif ?} ... {else} ... {/if}
  • {ifset ?} ... {elseifset ?} ... {/if}
  • {for ?} ... {/for}
  • {foreach ?} ... {/foreach}
  • {include ?}
  • {cache ?} ... {/cache} cached block
  • {snippet ?} ... {/snippet ?} control snippet
  • {attr ?} HTML element attributes
  • {block|texy} ... {/block} block
  • {contentType ...} HTTP Content-Type header
  • {status ...} HTTP status
  • {capture ?} ... {/capture} capture block to parameter
  • {var var => value} set template parameter
  • {default var => value} set default template parameter
  • {dump $var}
  • {debugbreak}
NObject
Extended by NLatteMacros

Direct known subclasses

NCurlyBracketsMacros
Package: Nette\Templates
Author: David Grudl
Located at Templates/Filters/LatteMacros.php
Methods summary
public
# __construct( )

Constructor.

Constructor.

public
# initialize( NLatteFilter $filter, string & $s )

Initializes parsing.

Initializes parsing.

Parameters

$filter
NLatteFilter
$s
string
public
# finalize( string & $s )

Finishes parsing.

Finishes parsing.

Parameters

$s
string
public string
# macro( string $macro, string $content, string $modifiers )

Process {macro content | modifiers}

Process {macro content | modifiers}

Parameters

$macro
string
$content
string
$modifiers
string

Returns

string
public string
# tagMacro( string $name, array $attrs, boolean $closing )

Process <n:tag attr> (experimental).

Process <n:tag attr> (experimental).

Parameters

$name
string
$attrs
array
$closing
boolean

Returns

string
public string
# attrsMacro( string $code, array $attrs, boolean $closing )

Process <tag n:attr> (experimental).

Process <tag n:attr> (experimental).

Parameters

$code
string
$attrs
array
$closing
boolean

Returns

string
public
# macroVar( $var, $modifiers )

{$var |modifiers}

{$var |modifiers}

public
# macroTranslate( $var, $modifiers )

{_$var |modifiers}

{_$var |modifiers}

public
# macroSyntax( $var )

{syntax ...}

{syntax ...}

public
# macroInclude( $content, $modifiers )

{include ...}

{include ...}

public
# macroExtends( $content )

{extends ...}

{extends ...}

public
# macroBlock( $content, $modifiers )

{block ...}

{block ...}

public
# macroBlockEnd( $content )

{/block}

{/block}

public
# macroSnippet( $content )

{snippet ...}

{snippet ...}

public
# macroSnippetEnd( $content )

{snippet ...}

{snippet ...}

public
# macroCapture( $content, $modifiers )

{capture ...}

{capture ...}

public
# macroCaptureEnd( $content )

{/capture}

{/capture}

public
# macroForeach( $content )

{foreach ...}

{foreach ...}

public
# macroAttr( $content )

{attr ...}

{attr ...}

public
# macroContentType( $content )

{contentType ...}

{contentType ...}

public
# macroDump( $content )

{dump ...}

{dump ...}

public
# macroWidget( $content )

{widget ...}

{widget ...}

public
# macroLink( $content, $modifiers )

{link ...}

{link ...}

public
# macroPlink( $content, $modifiers )

{plink ...}

{plink ...}

public
# macroIfCurrent( $content )

{ifCurrent ...}

{ifCurrent ...}

public
# macroAssign( $content, $modifiers )

{assign ...}

{assign ...}

public
# macroDefault( $content )

{default ...}

{default ...}

public
# macroEscape( $content )

Escaping helper.

Escaping helper.

public
# macroModifiers( $content, $modifiers )

Just modifiers helper.

Just modifiers helper.

public static
# callBlock( array & $blocks, string $name, array $params )

Calls block.

Calls block.

Parameters

$blocks
array
$name
string
$params
array
public static
# callBlockParent( array & $blocks, string $name, array $params )

Calls parent block.

Calls parent block.

Parameters

$blocks
array
$name
string
$params
array
public static NTemplate
# includeTemplate( mixed $destination, array $params, ITemplate $template )

Includes subtemplate.

Includes subtemplate.

Parameters

$destination
mixed
included file name or template
$params
array
parameters
$template
ITemplate
current template

Returns

NTemplate
public static stdClass
# initRuntime( ITemplate $template, boolean $extends, string $realFile )

Initializes state holder $_cb in template.

Initializes state holder $_cb in template.

Parameters

$template
ITemplate
$extends
boolean
$realFile
string

Returns

stdClass
Methods inherited from NObject
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Constants summary
integer BLOCK_NAMED 1
#
integer BLOCK_CAPTURE 2
#
integer BLOCK_ANONYMOUS 3
#
Properties summary
public static array $defaultMacros array( 'syntax' => '%:macroSyntax%', '/syntax' => '%:macroSyntax%', 'block' => '<?php %:macroBlock% ?>', '/block' => '<?php %:macroBlockEnd% ?>', 'capture' => '<?php %:macroCapture% ?>', '/capture' => '<?php %:macroCaptureEnd% ?>', 'snippet' => '<?php %:macroSnippet% ?>', '/snippet' => '<?php %:macroSnippetEnd% ?>', 'cache' => '<?php if ($_cb->foo = NCachingHelper::create($_cb->key = md5(__FILE__) . __LINE__, $template->getFile(), array(%%))) { $_cb->caches[] = $_cb->foo ?>', '/cache' => '<?php array_pop($_cb->caches)->save(); } if (!empty($_cb->caches)) end($_cb->caches)->addItem($_cb->key) ?>', 'if' => '<?php if (%%): ?>', 'elseif' => '<?php elseif (%%): ?>', 'else' => '<?php else: ?>', '/if' => '<?php endif ?>', 'ifset' => '<?php if (isset(%%)): ?>', '/ifset' => '<?php endif ?>', 'elseifset' => '<?php elseif (isset(%%)): ?>', 'foreach' => '<?php foreach (%:macroForeach%): ?>', '/foreach' => '<?php endforeach; array_pop($_cb->its); $iterator = end($_cb->its) ?>', 'for' => '<?php for (%%): ?>', '/for' => '<?php endfor ?>', 'while' => '<?php while (%%): ?>', '/while' => '<?php endwhile ?>', 'continueIf' => '<?php if (%%) continue ?>', 'breakIf' => '<?php if (%%) break ?>', 'include' => '<?php %:macroInclude% ?>', 'extends' => '<?php %:macroExtends% ?>', 'layout' => '<?php %:macroExtends% ?>', 'plink' => '<?php echo %:macroEscape%(%:macroPlink%) ?>', 'link' => '<?php echo %:macroEscape%(%:macroLink%) ?>', 'ifCurrent' => '<?php %:macroIfCurrent%; if ($presenter->getLastCreatedRequestFlag("current")): ?>', '/ifCurrent' => '<?php endif ?>', 'widget' => '<?php %:macroWidget% ?>', 'control' => '<?php %:macroWidget% ?>', 'attr' => '<?php echo NHtml::el(NULL)->%:macroAttr%attributes() ?>', 'contentType' => '<?php %:macroContentType% ?>', 'status' => '<?php NEnvironment::getHttpResponse()->setCode(%%) ?>', 'var' => '<?php %:macroAssign% ?>', 'assign' => '<?php %:macroAssign% ?>', 'default' => '<?php %:macroDefault% ?>', 'dump' => '<?php NDebug::consoleDump(%:macroDump%, "Template " . str_replace(NEnvironment::getVariable("appDir"), "\xE2\x80\xA6", $template->getFile())) ?>', 'debugbreak' => '<?php if (function_exists("debugbreak")) debugbreak(); elseif (function_exists("xdebug_break")) xdebug_break() ?>', '!_' => '<?php echo %:macroTranslate% ?>', '!=' => '<?php echo %:macroModifiers% ?>', '_' => '<?php echo %:macroEscape%(%:macroTranslate%) ?>', '=' => '<?php echo %:macroEscape%(%:macroModifiers%) ?>', '!$' => '<?php echo %:macroVar% ?>', '!' => '<?php echo %:macroVar% ?>', // deprecated '$' => '<?php echo %:macroEscape%(%:macroVar%) ?>', '?' => '<?php %:macroModifiers% ?>', // deprecated? )
#
public array $macros
#
Nette Framework 0.9.7 (for PHP 5.2) API documentation generated by ApiGen 2.3.0