Reputation: 1
I want to create template override for k2 item view.... I have a little problem (little, I think)
I want to put extra fields next to the item image.. (in item view)..
I trying it but not working properly.. If any one know how to do it help me. See the below image (to see exactly what I am asking)
http://postimg.org/image/aoeqqcay5/ Or http://postimg.org/image/6o112077x/ Thank you in advance..
Upvotes: 0
Views: 503
Reputation: 13
You can modify the file item.php, of k2 template.
Let's suppose are you using K2 Default template. So, .../com_k2/templates/default/item.php
The code to show the extra fields is around line 250 (k2 V2.6) :
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
<!-- 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; ?>
You can put it before the intro text code (maybe line 227):
<?php if(!empty($this->item->fulltext)): ?>
Of course you will need to make some css adjustments.
I hope this help you.
Upvotes: 1