Jump to content

Template help needed

Featured Replies

Posted

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 raw
2) Only display the code if the field value exists

?

Thanks in advance

  • Author

I tried removing "|raw" from the code but it still shows raw...

  • 2 weeks later...

You should refer the real table field like this:

$record->field_50

 

Otherwise the field value will always be parsed in any way.

 

  • Author

You should refer the real table field like this:

$record->field_50

Otherwise the field value will always be parsed in any way.

Thanks, but I'm talking about custom profile fields, not record fields..

  • Author

Bump

  • 2 weeks later...
  • Author

Bump

  • Author

Bump

Hello,

Write some examples what you want

1) Display the formatted value of the field, instead of raw

You mean  pf.thumb.png.fbabf3eade25da623a478c8d0ee

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.

  • Author

Hello,

Write some examples what you want

You mean  pf.thumb.png.fbabf3eade25da623a478c8d0ee

Hello,

Thanks for the response.

Yes, what I want is to show the "Display format" but the code in the OP only returns raw.

  • Author

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 :)

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}

 

  • Author
{{$fields = $comment->author()->contentProfileFields();}}
{$fields['core_pfieldgroups_<group_id>'][<field_id>]|raw}

 

Thank you so much! Worked perfectly.

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.