- Posts: 5
COMMUNITY FORUM
How to add k2 extra field inside the content
- Alex
- Topic Author
- Offline
- New Member
Less
More
5 years 9 months ago #171192
by Alex
Replied by Alex on topic How to add k2 extra field inside the content
Hi Mohamed how are you bro? It's possible also to add inside the Article "rate us" field? many thanks
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
- Offline
- Platinum Member
- Joomla Developer
5 years 8 months ago #171326
by Mohamed Abdelaziz
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Replied by Mohamed Abdelaziz on topic How to add k2 extra field inside the content
Hi Alex,
I'm good, thanks!
If it is a k2 extra field, most probably yes.
I'm good, thanks!
If it is a k2 extra field, most probably yes.
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Okan
- Offline
- New Member
Less
More
- Posts: 8
4 years 3 weeks ago #177275
by Okan
Replied by Okan on topic How to add k2 extra field inside the content
Hello Fotis,
This one doesn't work with k2 tools module.
K2 plugins enabled.
It gives nothing.
And yes i used my own allias instead of "EXTRAFIELD_ALIAS_HERE"
<?php echo $item->extraFields->EXTRAFIELD_ALIAS_HERE->value; ?>
This one doesn't work with k2 tools module.
K2 plugins enabled.
It gives nothing.
And yes i used my own allias instead of "EXTRAFIELD_ALIAS_HERE"
<?php echo $item->extraFields->EXTRAFIELD_ALIAS_HERE->value; ?>
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 3 weeks ago #177295
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic How to add k2 extra field inside the content
@Okan It's out of context ($item refers to something that is not globally defined), that's why.
I would recommend doing a K2 template override for item.php. A much better solution if you ask me...
I would recommend doing a K2 template override for item.php. A much better solution if you ask me...
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Stephan Tensen
- Offline
- New Member
Less
More
- Posts: 6
3 years 6 months ago - 3 years 6 months ago #178902
by Stephan Tensen
Replied by Stephan Tensen on topic How to add k2 extra field inside the content
PROBLEM SOLVED, I MADE A VERY STUPID MISTAKE ;-) (assuming a field is filled without checking)
I'm a newbie, but very excited about the good things K2 can do ;-)
At the moment I'm trying to display one or more extra fields in the content. I tried using the first method in my override version of category_item.php. I tried it in two ways. See below. It's about the extra field with the alias Prijs. I added TEST1 above the code and TEST2 below the code, to make sure I'm editing the right file. I see TEST1 and TEST2 but the code in between seems to do nothing.
I also downloaded and installed the plugin TExtrafield from Mohammed, but no result either when putting {extrafield Prijs} in the editor of the introtext of the item. So clearly I must be doing something completely wrong ;-) I set display Extra Fields off, because I don't want it to show ALL extra fields. Is that correct? What can I be doing wrong?
TEST1
<?php if($this->item->extraFields->Prijs->value != ''): ?>
<div class="itemExtraFieldswrapper">
<div class="itemExtraFieldsLabel"> <?php echo $this->item->extraFields->Prijs->name; ?></div>
<div class="itemExtraFieldsValue"><?php echo $this->item->extraFields->Prijs->value; ?></div>
</div>
<?php endif; ?>
<?php echo $this->item->extraFields->Prijs->value; ?>
TEST2
I'm a newbie, but very excited about the good things K2 can do ;-)
At the moment I'm trying to display one or more extra fields in the content. I tried using the first method in my override version of category_item.php. I tried it in two ways. See below. It's about the extra field with the alias Prijs. I added TEST1 above the code and TEST2 below the code, to make sure I'm editing the right file. I see TEST1 and TEST2 but the code in between seems to do nothing.
I also downloaded and installed the plugin TExtrafield from Mohammed, but no result either when putting {extrafield Prijs} in the editor of the introtext of the item. So clearly I must be doing something completely wrong ;-) I set display Extra Fields off, because I don't want it to show ALL extra fields. Is that correct? What can I be doing wrong?
TEST1
<?php if($this->item->extraFields->Prijs->value != ''): ?>
<div class="itemExtraFieldswrapper">
<div class="itemExtraFieldsLabel"> <?php echo $this->item->extraFields->Prijs->name; ?></div>
<div class="itemExtraFieldsValue"><?php echo $this->item->extraFields->Prijs->value; ?></div>
</div>
<?php endif; ?>
<?php echo $this->item->extraFields->Prijs->value; ?>
TEST2
Last edit: 3 years 6 months ago by Stephan Tensen. Reason: Problem solved
Please Log in or Create an account to join the conversation.