Kirill N Posted July 17, 2015 Posted July 17, 2015 Hello,@Rikki gave me the following code that displays the raw value of a specific custom field in post bit:{{$fields = $comment->author()->profileFields();}} {$fields['core_pfieldgroups_<group_id>']['core_pfield_<field_id>']|raw}How do I do either of the following:1) Display the formatted value of the field, instead of raw2) Only display the code if the field value exists?Thanks in advance
Kirill N Posted July 17, 2015 Author Posted July 17, 2015 I tried removing "|raw" from the code but it still shows raw...
xtech Posted July 29, 2015 Posted July 29, 2015 You should refer the real table field like this:$record->field_50 Otherwise the field value will always be parsed in any way.
Kirill N Posted July 31, 2015 Author Posted July 31, 2015 You should refer the real table field like this:$record->field_50Otherwise the field value will always be parsed in any way.Thanks, but I'm talking about custom profile fields, not record fields..
newbie LAC Posted August 18, 2015 Posted August 18, 2015 Hello, Write some examples what you want 1) Display the formatted value of the field, instead of raw You mean
Meddysong Posted August 18, 2015 Posted August 18, 2015 I think his problem is very similar to mine here, which is that if you call a field that way, it appears in its raw form but without any formatting. Yes, it's possible within the template to type some html, but that's still not good in situations like mine where you want to suppress the label in one field/have nothing at all appear if there's no value for that instance/have custom formatting depending on the output.
Kirill N Posted August 18, 2015 Author Posted August 18, 2015 Hello, Write some examples what you want You mean Hello, Thanks for the response. Yes, what I want is to show the "Display format" but the code in the OP only returns raw.
Kirill N Posted August 18, 2015 Author Posted August 18, 2015 I think his problem is very similar to mine here, which is that if you call a field that way, it appears in its raw form but without any formatting. Yes, it's possible within the template to type some html, but that's still not good in situations like mine where you want to suppress the label in one field/have nothing at all appear if there's no value for that instance/have custom formatting depending on the output.Exactly, except my problem is with profile fields while yours is with record fields :)
newbie LAC Posted August 19, 2015 Posted August 19, 2015 Hello,Thanks for the response.Yes, what I want is to show the "Display format" but the code in the OP only returns raw.{{$fields = $comment->author()->contentProfileFields();}} {$fields['core_pfieldgroups_<group_id>'][<field_id>]|raw}
Kirill N Posted August 19, 2015 Author Posted August 19, 2015 {{$fields = $comment->author()->contentProfileFields();}} {$fields['core_pfieldgroups_<group_id>'][<field_id>]|raw} Thank you so much! Worked perfectly.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.