[Use strlen()] Hide if empty, does not work for relation reverse field

6 months 3 weeks ago - 6 months 3 weeks ago #69662 by marc.light
Hi,

I have created a template for item.php. When I have a field that I don't want to show if empty I use these lines:

<?php if (isset($item->fields["fiield_name"]->display)) : ?>
<?php echo $item->fields["field_name"]->display; ?>
<?php endif; ?>

It works fine but it does not work when I use a relation_reverse field. Can someone help?

Thanks.

Please Log in or Create an account to join the conversation.

6 months 3 weeks ago - 6 months 3 weeks ago #69663 by ggppdk
Hello

by your description it is probably a bug,
but this should be quite easy to fix

please open a new issue at github
github.com/FLEXIcontent/flexicontent-cck/issues

and will look at it , fix it for next release , and provide patch for you to use fix in current version


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

6 months 3 weeks ago #69664 by marc.light

Please Log in or Create an account to join the conversation.

6 months 3 weeks ago - 6 months 3 weeks ago #69666 by ggppdk
Hello

Check and fixed a different issue that is not related to your report

The relation field was producing empty when div when none of the related items was e.g. published items and show total info was ON

Your code to check field is empty is incomplete, correct code is (if field is not inside fieldgroup)
<?php if (isset($item->fields["fiield_name"]->display) && strlen($item->fields["fiield_name"]->display)) : ?>
  <?php echo $item->fields["field_name"]->display; ?>
<?php endif; ?>

isset would be enough only if checking $item->positions !!
if checking
$item->fields["fiield_name"]->display

you also need to use strlen


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

6 months 3 weeks ago #69672 by marc.light
Works perfectly! Thanks again.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.