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
  • {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
  • {l} {r} to display { }

Methods

static void
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]}

macroCapture(MacroNode $node, PhpWriter $writer)

{capture $variable}

macroCaptureEnd(MacroNode $node, PhpWriter $writer)

{/capture}

macroSpaceless(MacroNode $node, PhpWriter $writer)

{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 .

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 .

macroExpr(MacroNode $node, PhpWriter $writer)

{= .

macroContentType(MacroNode $node, PhpWriter $writer)

{contentType .

Details

at line 46
static void install(Compiler $compiler)

Parameters

Compiler $compiler

Return Value

void

at line 94
void initialize()

Initializes before template parsing.

Return Value

void

at line 104
array|null finalize()

Finishes template parsing.

Return Value

array|null [prolog, epilog]

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

{if .

..}

Parameters

MacroNode $node
PhpWriter $writer

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

{/if .

..}

Parameters

MacroNode $node
PhpWriter $writer

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

{else}

Parameters

MacroNode $node
PhpWriter $writer

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

n:ifcontent

Parameters

MacroNode $node
PhpWriter $writer

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

n:ifcontent

Parameters

MacroNode $node
PhpWriter $writer

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

{_$var |modifiers}

Parameters

MacroNode $node
PhpWriter $writer

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

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

Parameters

MacroNode $node
PhpWriter $writer

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

{capture $variable}

Parameters

MacroNode $node
PhpWriter $writer

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

{/capture}

Parameters

MacroNode $node
PhpWriter $writer

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

{spaceless} .

.. {/spaceless}

Parameters

MacroNode $node
PhpWriter $writer

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

{while .

..}

Parameters

MacroNode $node
PhpWriter $writer

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

{/while .

..}

Parameters

MacroNode $node
PhpWriter $writer

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

{foreach .

..}

Parameters

MacroNode $node
PhpWriter $writer

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

{breakIf .

..} {continueIf ...}

Parameters

MacroNode $node
PhpWriter $writer

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

n:class=".

.."

Parameters

MacroNode $node
PhpWriter $writer

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

n:attr=".

.."

Parameters

MacroNode $node
PhpWriter $writer

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

{dump .

..}

Parameters

MacroNode $node
PhpWriter $writer

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

{debugbreak .

..}

Parameters

MacroNode $node
PhpWriter $writer

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

{var .

..} {default ...}

Parameters

MacroNode $node
PhpWriter $writer

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

{= .

..} {php ...}

Parameters

MacroNode $node
PhpWriter $writer

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

{contentType .

..}

Parameters

MacroNode $node
PhpWriter $writer