sahidul islam
sahidul islam

Reputation: 3

how to pass variable from page to partial

HI I want to pass a value from my page and grab it on partial,for example bellow is example Main layout

<html lang="en">
  <head>
   .....
  </head>
  <body>
    {% partial 'a_partial' %}
  </body>
</html>

And my partial

<h1>{{ value-from-page}}</h1>

and on page I tried like bellow

function onRender()
{
    $this['value-from-page'] = "A string";
}
==

This way I am getting output on partial '0',I tried dump() on partial and its showing 'value-from-page' and its value. What is wrong am I doing?

Upvotes: 0

Views: 383

Answers (1)

Serena Villa
Serena Villa

Reputation: 69

Simply pass your variables this way:

{% partial 'a_partial' var1='var 1 content' var2='var 2 content' %}

Upvotes: 1

Related Questions