Skip to content

02.30 Sub parser's events

rafageist edited this page Nov 16, 2026 · 1 revision

2.30 Eventos de los sub-parsers

Los sub-parsers pueden ejecutarse en distintos momentos del ciclo de análisis. Los eventos disponibles son beforeParse, afterInclude y afterParse.

Ejemplo

index.tpl

{= name: "Peter" =}
{= products: [
    { name: "banana", price: 40 },
    { name: "potato", price: 25 }
] =}

[$products]
    {parse:beforeParse}
    Name: {$name}
    {/parse:beforeParse}

    Product name: {$name}

    {% other %}
[/$products]

other.tpl

{parse:beforeParse}
    Other name: {$name}
{/parse:beforeParse}

Salida

Name: Peter
Product name: banana
Other name: banana
Name: Peter
Product name: potato
Other name: potato

Div

Enlaces

Clone this wiki locally