class CoreMacros extends MacroSet

Basic macros for Latte.

  • {if ?} ... {elseif ?} ... {else} ... {/if}
  • {ifset ?} ... {elseifset ?} ... {/ifset}
  • {for ?} ... {/for}
  • {foreach ?} ... {/foreach}
  • {$variable} with escaping
  • {=expression} echo with escaping
  • {php expression} evaluate PHP statement
  • {_expression} echo translation with escaping
  • {attr ?} HTML element attributes
  • {capture ?} ... {/capture} capture block to parameter
  • {spaceless} ... {/spaceless} compress whitespaces
  • {var var => value} set template parameter
  • {default var => value} set default template parameter
  • {dump $var}
  • {debugbreak}
  • {contentType ...} HTTP Content-Type header
  • {status ...} HTTP status
  • {l} {r} to display { }

Methods

static 
install(Compiler $compiler)

No description

void
initialize()

Initializes before template parsing.

array|null
finalize()

Finishes template parsing.

macroIf(MacroNode $node, PhpWriter $writer)

{if ...}

macroEndIf(MacroNode $node, PhpWriter $writer)

{/if ...}

macroElse(MacroNode $node, PhpWriter $writer)

{else}

macroIfContent(MacroNode $node, PhpWriter $writer)

n:ifcontent

macroEndIfContent(MacroNode $node, PhpWriter $writer)

n:ifcontent

macroTranslate(MacroNode $node, PhpWriter $writer)

{_$var |modifiers}

macroInclude(MacroNode $node, PhpWriter $writer)

{include "file" [,] [params]}

macroUse(MacroNode $node, PhpWriter $writer)

{use class MacroSet}

macroCapture(MacroNode $node, PhpWriter $writer)

{capture $variable}

macroCaptureEnd(MacroNode $node, PhpWriter $writer)

{/capture}

macroSpaceless(MacroNode $node, PhpWriter $writer)

{spaceless} ... {/spaceless}

macroWhile(MacroNode $node, PhpWriter $writer)

{while ...}

macroEndWhile(MacroNode $node, PhpWriter $writer)

{/while ...}

macroEndForeach(MacroNode $node, PhpWriter $writer)

{foreach ...}

macroBreakContinueIf(MacroNode $node, PhpWriter $writer)

{breakIf ...} {continueIf ...}

macroClass(MacroNode $node, PhpWriter $writer)

n:class="..."

macroAttr(MacroNode $node, PhpWriter $writer)

n:attr="..."

macroDump(MacroNode $node, PhpWriter $writer)

{dump ...}

macroDebugbreak(MacroNode $node, PhpWriter $writer)

{debugbreak ...}

macroVar(MacroNode $node, PhpWriter $writer)

{var ...} {default ...}

macroExpr(MacroNode $node, PhpWriter $writer)

{= ...} {php ...}

macroContentType(MacroNode $node, PhpWriter $writer)

{contentType ...}

macroStatus(MacroNode $node, PhpWriter $writer)

{status ...}

Details

at line 46
static install(Compiler $compiler)

No description

Parameters

Compiler $compiler

at line 97
void initialize()

Initializes before template parsing.

Return Value

void

at line 107
array|null finalize()

Finishes template parsing.

Return Value

array|null

[prolog, epilog]

at line 125
macroIf(MacroNode $node, PhpWriter $writer)

{if ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 143
macroEndIf(MacroNode $node, PhpWriter $writer)

{/if ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 162
macroElse(MacroNode $node, PhpWriter $writer)

{else}

Parameters

MacroNode $node
PhpWriter $writer

at line 185
macroIfContent(MacroNode $node, PhpWriter $writer)

n:ifcontent

Parameters

MacroNode $node
PhpWriter $writer

at line 196
macroEndIfContent(MacroNode $node, PhpWriter $writer)

n:ifcontent

Parameters

MacroNode $node
PhpWriter $writer

at line 207
macroTranslate(MacroNode $node, PhpWriter $writer)

{_$var |modifiers}

Parameters

MacroNode $node
PhpWriter $writer

at line 229
macroInclude(MacroNode $node, PhpWriter $writer)

{include "file" [,] [params]}

Parameters

MacroNode $node
PhpWriter $writer

at line 252
macroUse(MacroNode $node, PhpWriter $writer)

{use class MacroSet}

Parameters

MacroNode $node
PhpWriter $writer

at line 266
macroCapture(MacroNode $node, PhpWriter $writer)

{capture $variable}

Parameters

MacroNode $node
PhpWriter $writer

at line 281
macroCaptureEnd(MacroNode $node, PhpWriter $writer)

{/capture}

Parameters

MacroNode $node
PhpWriter $writer

at line 293
macroSpaceless(MacroNode $node, PhpWriter $writer)

{spaceless} ... {/spaceless}

Parameters

MacroNode $node
PhpWriter $writer

at line 308
macroWhile(MacroNode $node, PhpWriter $writer)

{while ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 323
macroEndWhile(MacroNode $node, PhpWriter $writer)

{/while ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 338
macroEndForeach(MacroNode $node, PhpWriter $writer)

{foreach ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 368
macroBreakContinueIf(MacroNode $node, PhpWriter $writer)

{breakIf ...} {continueIf ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 384
macroClass(MacroNode $node, PhpWriter $writer)

n:class="..."

Parameters

MacroNode $node
PhpWriter $writer

at line 396
macroAttr(MacroNode $node, PhpWriter $writer)

n:attr="..."

Parameters

MacroNode $node
PhpWriter $writer

at line 405
macroDump(MacroNode $node, PhpWriter $writer)

{dump ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 421
macroDebugbreak(MacroNode $node, PhpWriter $writer)

{debugbreak ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 436
macroVar(MacroNode $node, PhpWriter $writer)

{var ...} {default ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 487
macroExpr(MacroNode $node, PhpWriter $writer)

{= ...} {php ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 502
macroContentType(MacroNode $node, PhpWriter $writer)

{contentType ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 539
macroStatus(MacroNode $node, PhpWriter $writer)

{status ...}

Parameters

MacroNode $node
PhpWriter $writer