geniv/nette-macros

Latte macros extension for Nette Framework

v1.1.0 2018-07-03 23:04 UTC

This package is auto-updated.

Last update: 2024-12-14 04:24:14 UTC


README

Latte macros

Installation

$ composer require geniv/nette-macros

or

"geniv/nette-macros": ">=1.0.0"

require:

"php": ">=5.6.0",
"nette/nette": ">=2.4.0"

Include in application

neon configure:

extensions:
    - Macros\Bridges\Nette\Extension

IfCurrent (n:class="$presenter->linkCurrent ? ..."):

<div n:ifCurrent="Homepage:default">aktivni sekce Homepage:default</div>
{ifCurrent 'Homepage:default'}aktivni sekce Homepage:default{/ifCurrent}

IfCurrentIn:

<div n:ifCurrentIn="'News:default', 'Homepage:default'">Hello, n:macro</div>
{ifCurrentIn 'News:default', 'Homepage:default'}Hello, standart macro{/ifCurrentIn}

IfCurrentSwitch:

{ifCurrentSwitch}
    {ifCurrentCase 'Homepage:default'}
        layout-variant-hp
    {ifCurrentCase 'Homepage:vzor'}
        layout-variant-location
    {ifCurrentDefault}
        layout-variant-sub
{/ifCurrentSwitch}

SubmitButton:

{form formName}
    {button controlName, class=>"btn"}
        <i class="icon icon-ok"></i>
        {caption}
    {/button}
{/form}

{form formName}
	{button $_form['controlName'], class=>"btn"}
		<i class="icon icon-ok"></i>
		{caption}
	{/button}
{/form}

Confirm:

<a href="..." n:confirm="'Really delete?'">delete</a>
<a href="..." n:confirm="$presenter->translator->translate('translate-confirm')">delete</a>

DataStream:

{dataStream}/www/images/logo.png{/dataStream}

if image does not exist then result null