jDownloadsownloads.com


Author Topic: Hiding Placeholder Variables When They the Custom Field is Empty  (Read 555 times)

0 Members and 1 Guest are viewing this topic.

Offline Bilal Abdeen

  • Newbie
  • *
  • Posts: 7
Thank you for the excellent extension.

It will be great if placeholder variables for custom fields, which are used in layouts, are hidden when the relevant custom fields have no values (not populated with data).

For example, I will define a custom field called "custom_field_1." Some downloads have the value for this field populated, while other downloads have the value empty. I want the placeholder variables {custom_title_1} & {custom_value_1} to be displayed for downloads, which have the value populated, and hidden for the downloads, which have the value empty.

<!-- The following statement should display nothing if the custom_field_1 is empty for this dowload -->
{custom_title_1} {custom_value_1}

I understand that if {custom_field_1} is not defined at all, the placeholder variables are not be displayed.

Thanks

Offline ColinM

  • Moderator
  • *
  • Posts: 3.927
HiThere are two aspects here.  Firstly the jD Custom Fiellds in jD3.2 series are being replaced by the use of Joomla! Fields.  When upgrading to version 3.9, which is in beta test, existing jD custom fields are automatically converted to corresponding Joomla! Field.
There are equivalent ways to show those in Layouts - placeholders {jdfield_title 'id'} and {jdfield 'id'}.  At the moment these suffer from the same problem as you have identified..  Some time ago I lodged a request that if  {jdfield 'id'} was 'empty' then there should be an option to not show {jdfield_title 'id'}.  This is not as easy as it sounds as some users like to show the title when the field value is not set.  Field values are also slightly more complex as they can have a default value.
Colin