XF 2.1 Correct approach to get data from PHP and use it as variable in a template

AlessioDP

Member
Hi, I want to ask you what is the correct approach to print some generic data into any template?

This is a quick example on what I'm trying to do:
I can generate the data only from PHP and I wanna put that data into a template variable like this:
HTML:
<div>
    $myData
    <xf:macro template="blabla" name="blabla" arg-data="$myData" />
</div>

I've seen that I can do something similar to that by using a Controller, but I'm not sure about what is the correct way to do it, especially because that data can be in a lot of templates.
 
Back
Top Bottom