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

More
6 years 6 months ago - 6 years 6 months 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.
Last edit: 6 years 6 months ago by ggppdk.

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

More
6 years 6 months ago - 6 years 6 months 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...
Last edit: 6 years 6 months ago by ggppdk.

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

More
More
6 years 6 months ago - 6 years 6 months 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)
Code:
<?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...
Last edit: 6 years 6 months ago by ggppdk.

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

More
6 years 6 months ago #69672 by marc.light
Works perfectly! Thanks again.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.433 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline