Mini K2 customization
- Posted by atanetfq (3) Offline
I tried to add specific "K2 extra filed" to Mini K2 as explained in this tutorial:
getk2.org/documentation/tips-a-tricks/it...fic-extra-field-data
For some reason it doesn`t work. Is where some solution to display specific extra field in Mini K2 module (Simple template)?
Thank you in advance,
Gideon
12 years 4 months ago #1
by atanetfq
getk2.org/documentation/tips-a-tricks/it...fic-extra-field-data
For some reason it doesn`t work. Is where some solution to display specific extra field in Mini K2 module (Simple template)?
Thank you in advance,
Gideon
Please Log in or Create an account to join the conversation.
- Posted by erwinschro (1034) Offline
Hello
I believe you have standart K2 content module in place (mod_k2_content). If you take a closer look at it's mod_k2_content/tmpl/default.php, you will see this extrafields part below where you can paste it on .mod_minik2/tmpl/simple/default.php
Have a try...
12 years 4 months ago #2
by erwinschro
I believe you have standart K2 content module in place (mod_k2_content). If you take a closer look at it's mod_k2_content/tmpl/default.php, you will see this extrafields part below where you can paste it on .mod_minik2/tmpl/simple/default.php
<?php if($params->get('itemExtraFields') && count($item->extra_fields)): ?>
<div class="moduleItemExtraFields">
<b><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></b>
<ul>
<?php foreach ($item->extra_fields as $extraField): ?>
<?php if($extraField->value): ?>
<li class="type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<span class="moduleItemExtraFieldsLabel"><?php echo $extraField->name; ?></span>
<span class="moduleItemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<div class="clr"></div>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
Have a try...
Please Log in or Create an account to join the conversation.
- Posted by atanetfq (3) Offline
It doesnt help... I tried it before posting here. And I need to display specific extra field, not all of them
12 years 4 months ago #3
by atanetfq
Please Log in or Create an account to join the conversation.
- Posted by erwinschro (1034) Offline
I didn't read well before that you need only a specific extrafield.
For that then you need to count which one from those extrafields you've created in order. For example if it's an extrafield n-th then you should call it with
<?php
echo $item->extra_fields[n-1]->value;
?>
12 years 4 months ago #4
by erwinschro
For that then you need to count which one from those extrafields you've created in order. For example if it's an extrafield n-th then you should call it with
<?php
echo $item->extra_fields[n-1]->value;
?>
Please Log in or Create an account to join the conversation.
- Posted by atanetfq (3) Offline
You mean, if I want to display extra field that has ID=1, so I should use this code ( n-1 = 1-1 = 0) :
Thank you in advance
12 years 4 months ago #5
by atanetfq
<?php
echo $item->extra_fields[0]->value;
?>
Thank you in advance
Please Log in or Create an account to join the conversation.
- Posted by Mehmet (2) Offline
my extrafields group name "book"
extrafield id 1 name "pages"
extrafield id 2 name "cover"
how i show in mini k2
12 years 3 months ago #6
by Mehmet
extrafield id 1 name "pages"
extrafield id 2 name "cover"
how i show in mini k2
Please Log in or Create an account to join the conversation.