Jump to content

Template help needed


Kirill N

Recommended Posts

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

  • 2 weeks later...
Posted

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..

  • 2 weeks later...
Posted

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.

Posted

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.

Posted

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

Posted

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}

 

Posted
{{$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 members

    • No registered users viewing this page.
×
×
  • Create New...