XF 2.0 passing additonal parameters with the entity to templates

wasif

Member
So i have a situation where i have array of entities in my params , I need to pass some variables with each entity individually.

i'm trying to do this

Code:
$params['entity'][10]->newVariable = "test";

It throw an error saying
Column 'test' is unknown i

What is best and appropriate to pass params with the entities to the templates.
 
You would pass them along in a separate array. (Or you'd change your array structure so that it's multi-dimensional, storing the value you need and the entity in separate keys under a grouping.)
 
Thanks @Mike

Another question please.

So I have another station where i need thread entity in "helper_attach_upload" template's uploaded_file macro during post edit
what i'm doing is template modifications of all templates down till the uploaded_file macro to pass my additional/custom arg till the uploaded_file
macro.

but i have feeling that this is not the appropriate way to do this!

What is the best way to use parent template variables down till the last macro called? extending all the macros declaration and call doesn't sound nice to me?

back in xf1 we use to have access of all parent variables in child templates due to xf:include.But in xf2 we are only passing some specific variables with xf:macro

Thanks again.
 
@Chris D can you please look into this

Another question please.

So I have another station where i need thread entity in "helper_attach_upload" template's uploaded_file macro during post edit
what i'm doing is template modifications of all templates down till the uploaded_file macro to pass my additional/custom arg till the uploaded_file
macro.

but i have feeling that this is not the appropriate way to do this!

What is the best way to use parent template variables down till the last macro called? extending all the macros declaration and call doesn't sound nice to me?

back in xf1 we use to have access of all parent variables in child templates due to xf:include.But in xf2 we are only passing some specific variables with xf:macro
 
Back
Top Bottom