- Posts: 44
COMMUNITY FORUM
Display an extraField in a module
- yannick berges
- Topic Author
- Offline
- Senior Member
Less
More
7 years 6 months ago #160809
by yannick berges
Display an extraField in a module was created by yannick berges
hello i want to display an extrafield in module like a custom html module (with sourcer) or other solution
my goal is :
- user can manage image in item
- image is display in module position for better styling
thanks for any help
my goal is :
- user can manage image in item
- image is display in module position for better styling
thanks for any help
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 6 months ago #160816
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Display an extraField in a module
You can use the K2 Content module to display the extrafields although you can style them any way you want in the component as well.
Furthermore the edit button is only available in the component.
Furthermore the edit button is only available in the component.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Joe Campbell
- Offline
- Platinum Member
Less
More
- Posts: 438
7 years 6 months ago #160854
by Joe Campbell
Replied by Joe Campbell on topic Display an extraField in a module
Hi @Krikor please provide the K2 Content Module override code for only displaying a specific extra field.
Please Log in or Create an account to join the conversation.
- Nazmal Hossain
- Offline
- New Member
Less
More
- Posts: 9
7 years 6 months ago #160860
by Nazmal Hossain
Replied by Nazmal Hossain on topic Display an extraField in a module
If you want to display specific extra field then you can use like this below code
<?php
$k2obj = new K2ModelItem();
$fields = $k2obj->getItemExtraFields($item->extra_fields, $item);
?>
<?php if($item->extraFields->TitleOne->value!='') {?>
<span class="title"><?php echo $item->extraFields->TitleOne->value; ?></span>
<?php } ?>
Here TitleOne is the alias of k2 extra field.
<?php
$k2obj = new K2ModelItem();
$fields = $k2obj->getItemExtraFields($item->extra_fields, $item);
?>
<?php if($item->extraFields->TitleOne->value!='') {?>
<span class="title"><?php echo $item->extraFields->TitleOne->value; ?></span>
<?php } ?>
Here TitleOne is the alias of k2 extra field.
Please Log in or Create an account to join the conversation.
- Joe Campbell
- Offline
- Platinum Member
Less
More
- Posts: 438
7 years 6 months ago #160861
by Joe Campbell
Replied by Joe Campbell on topic Display an extraField in a module
Thanks Nazmal - but this does not work
Please Log in or Create an account to join the conversation.
- Nazmal Hossain
- Offline
- New Member
Less
More
- Posts: 9
7 years 6 months ago #160863
by Nazmal Hossain
Replied by Nazmal Hossain on topic Display an extraField in a module
Code I posted on previous email working many of my sites. Please check carefully. May be you not working on correct file. Or you are not writing extrafield alias. Or missing something else. But it should work correctly.
Please Log in or Create an account to join the conversation.
- Joe Campbell
- Offline
- Platinum Member
Less
More
- Posts: 438
7 years 6 months ago #160864
by Joe Campbell
Replied by Joe Campbell on topic Display an extraField in a module
You have used it to produce a K2 Content Module (override)?
This is how I tried to implement it.
This is how I tried to implement it.
Please Log in or Create an account to join the conversation.
- Nazmal Hossain
- Offline
- New Member
Less
More
- Posts: 9
7 years 6 months ago #160865
by Nazmal Hossain
Replied by Nazmal Hossain on topic Display an extraField in a module
Yes template overwrite. Say my template name is loanton. Then file will stay in
templates/loanton/html/mod_k2_content/Default/default.php
Please make sure that, from backend k2 content module area, you have selected extra field show [yes]
templates/loanton/html/mod_k2_content/Default/default.php
Please make sure that, from backend k2 content module area, you have selected extra field show [yes]
Please Log in or Create an account to join the conversation.
- Joe Campbell
- Offline
- Platinum Member
Less
More
- Posts: 438
7 years 6 months ago #160867
by Joe Campbell
Replied by Joe Campbell on topic Display an extraField in a module
The extra field parameter is set to "Show"
I even added plain text in the override module.
The plain text displays, but the extra field does not.
Please provide the code for the entire override file.
I even added plain text in the override module.
The plain text displays, but the extra field does not.
Please provide the code for the entire override file.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 6 months ago #160869
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Display an extraField in a module
It's the same as the component check the usual repo :).
Keep in mind where $this->item and $item is being used.
Enable extrafields, use that code and comment out the loop which prints all extrafields (if you don't need them).
Keep in mind where $this->item and $item is being used.
Enable extrafields, use that code and comment out the loop which prints all extrafields (if you don't need them).
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.