Keyword

empty extra fields not hidden !?

  • Christian Krassnitzer
  • Christian Krassnitzer's Avatar Topic Author
  • Offline
  • New Member
More
7 years 9 months ago #154856 by Christian Krassnitzer
empty extra fields not hidden !? was created by Christian Krassnitzer
hello friends of k2,

i have the same problem :
www.joomlaworks.net/forum/k2-en/44821-hide-empty-row#151294

i dont know why, but you can see every empty extra field in article view....
i tried a few things in my item.php but i think i am to weak in PHP to change it right :-(

here ist the standard code of item.php

<!-- Item extra fields -->
<div class="itemExtraFields">
<h3><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h3>
<ul>
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<?php if($extraField->type == 'header'): ?>
<h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>

other topics told about that is standard that empty fields are not showing, but i have no overrides and no plugins!?!?

please help me if you have an idea.... thank you!

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

  • JoomlaWorks Support Team
  • JoomlaWorks Support Team's Avatar
  • Offline
  • Elite Member
More
7 years 9 months ago #154858 by JoomlaWorks Support Team
Replied by JoomlaWorks Support Team on topic empty extra fields not hidden !?
Hi,
Replace this part
<span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>

with the following
<?php if($extraField->value !=''): ?>
<span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<?php endif; ?>

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum