Keyword

How to add k2 extra field inside the content

More
5 years 2 months ago #171192 by Alex
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
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
5 years 2 months ago #171326 by Mohamed Abdelaziz
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.

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.

More
3 years 5 months ago #177275 by Okan
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; ?>

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

More
3 years 5 months ago #177295 by JoomlaWorks
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...

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
2 years 11 months ago - 2 years 11 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
Last edit: 2 years 11 months ago by Stephan Tensen. Reason: Problem solved

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


Powered by Kunena Forum