{$user.$fieldId} in Template?

Jake B.

Well-known member
So, I'm looping through some values in the 'message_user_info' template and need to display userinfo based on the ID I have in a variable. I need to replicate something like '$user[$fieldId]' in a template. I've tried using $user.fieldId but it didn't work. I know I can go through the values by extending a view and adding the values that way, but I'd rather not have to do that for every view that uses the 'message' template so it'll be compatible with any other add-ons using the 'message' template that may be installed on the same board.
 
If $fieldId is another variable, you should can accomplish it with:
{$user.{$fieldId}}

Here's an example in use in the Resource Manager:
Code:
{$fileParams.{$uploaderId}.hash}
 
I had tried that, but it was in a helper and I wasn't using curly braces because I wasn't using it in a string, I'll try it that way though.
 
Back
Top Bottom