- Posts: 2
COMMUNITY FORUM
itemExtraFieldsValue as list instead of commas
- Julián
- Topic Author
- Offline
- New Member
Less
More
12 years 5 months ago #66950
by Julián
itemExtraFieldsValue as list instead of commas was created by Julián
Hi there, i was looking at the code in ../components/com_k2/templates/default/item.phpBut 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
<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>
Thanks
Please Log in or Create an account to join the conversation.
- kwnstantinoulis
- Offline
- New Member
Less
More
- Posts: 5
12 years 5 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:
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
12 years 5 months ago #66952
by Julián
Replied by Julián on topic Re: itemExtraFieldsValue as list instead of commas
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.