Arthur Cantu Posted September 27, 2018 Share Posted September 27, 2018 How can I call a custom field in the template file? I tried some variations of {soldier="custom_fields[1]" id="$soldier"} but couldn't figure it out. Quote Link to comment Share on other sites More sharing options...
Administrators Jon Erickson Posted September 27, 2018 Administrators Share Posted September 27, 2018 Custom fields are stored as JSON data in the 'perscom_personnel' table under the column 'personnel_custom_fields'. You should be able to pull this data like the following: {soldier="custom_fields" id="$soldier->id"} This will return JSON data. Make sure to pass the soldier's id to the ID parameter, rather than the soldier object. However, because this is a template plugin, you cannot do anything with that data. My suggestion is to do something like the following: {{$fields = json_decode($soldier->custom_fields, YES);}} You can then display the data like so: {$fields['the custom field id']} 1 Quote Owner Deschutes Design Group LLC email | jon@deschutesdesigngroup.com Link to comment Share on other sites More sharing options...
ClanHBS Posted August 27, 2020 Share Posted August 27, 2020 @Jon Erickson can this be explained a bit more in detail? can u explain how to obtain the id and an example of the code Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.