Keyword

itemExtraFieldsValue as list instead of commas

  • Julián
  • Julián's Avatar Topic Author
  • Offline
  • New Member
More
12 years 3 months ago #66950 by Julián
Hi there, i was looking at the code in ../components/com_k2/templates/default/item.php
<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; ?>">
                                <span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
                                <span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
                        </li>
                        <?php endif; ?>
                        <?php endforeach; ?>
                        </ul>
            <div class="clr"></div>
          </div>
But i dont know how to pull those extrafields values as a list instead of comma separated. Anyone can pointme out in the right direction?

Thanks

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

More
12 years 3 months ago #66951 by kwnstantinoulis
Replied by kwnstantinoulis on topic Re: itemExtraFieldsValue as list instead of commas
The code you posted seems to pull out the extra fields as a list's elements. An unordered list to be exact.
If you want them as comma seperated values, use the code below:
Julián wrote: Hi there, i was looking at the code in ../components/com_k2/templates/default/item.php
<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; ?>">
                                <span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
                                <span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
                        </li>
                        <?php endif; ?>
                        <?php endforeach; ?>
                        </ul>
            <div class="clr"></div>
          </div>
But i dont know how to pull those extrafields values as a list instead of comma separated. Anyone can pointme out in the right direction?

Thanks

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

  • Julián
  • Julián's Avatar Topic Author
  • Offline
  • New Member
More
12 years 3 months ago #66952 by Julián
Thanks Konstantinos! Its correct, extrafields are pulled as a list. Bur what im trying to get are the values inside those extrafields listed as a <li> elements. But they keep as csv :(

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


Powered by Kunena Forum