- Posts: 11
COMMUNITY FORUM
Where to edit K2 after Item Fields
- Mladen Mijatovic
-
Topic Author
- Offline
- New Member
In source I see this section is marked as "Plugins: AfterDisplayContent" but I don't know where to find it in backend.
I know there is extra fields option, but with that option I get two separated sections with "More details" fields.
Help please
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Have a look at this post , it explains how to achieve what you want.
Please Log in or Create an account to join the conversation.
- Mladen Mijatovic
-
Topic Author
- Offline
- New Member
- Posts: 11
Not so easy to fit into fields after item with my modest php knowledge, but I surely find a solution to put extra field name and value everywhere I want, thanks to you.
Appreciate that.
If someone have enough time and knowledge to put extra field name and value directly into these fields so it looks natural, please put a php source here I'll appreciate that too.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Log in or Create an account to join the conversation.
- Mladen Mijatovic
-
Topic Author
- Offline
- New Member
- Posts: 11
Thank you for your effort. Finally made what I want!
Please Log in or Create an account to join the conversation.
- Joe Campbell
-
- Offline
- Platinum Member
- Posts: 438
What does this line of the code do...
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
As I understand that this line tells the script to display whatever comes next if the extra field has a value
<?php if(isset($this->item->extraFields->EXTRAFIELDALIASHERE->value)): ?>
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
-
- Offline
- Platinum Member
- Joomla Developer
The first line checks whether that k2 item has extra fields, i.e its parent category has a group assigned to it and this group has children extra fields, and also checks whether K2 is configured to display extra fields on the item view page.Joseph wrote: Your post is most helpful, I do have a question (I am not a coder :-)
What does this line of the code do...
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
As I understand that this line tells the script to display whatever comes next if the extra field has a value
<?php if(isset($this->item->extraFields->EXTRAFIELDALIASHERE->value)): ?>
As you said, this is to display whatever comes next, mainly what comes next are extra fields.
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.
- Joe Campbell
-
- Offline
- Platinum Member
- Posts: 438
Based on what you said, the first line of code is not really needed, because if the item does not have Extra Fields assigned to it, it will just return/show nothing...correct?
Plus the display Extra Field parameter (based on category or item settings) determines if the item will display the extra fields. Does the first line of code have the ability to supersede the Extra Field parameter...is that the case?
I ask all of this (please remember, I am not a coder) because I want to create Item Template Overrides that will either
1) Display required extra field data (example: primary image), in that case, I would use
<img src="
<?php echo $this->item->extraFields->IMAGE1ALIAS->value; ?>
" />
2) Display non-required extra field data (example: secondary image), in that case, I would use
<?php if(isset($this->item->extraFields->IMAGE2ALIAS->value)): ?>
<img src="
<?php echo $this->item->extraFields->IMAGE2ALIAS->value; ?>
" />
<?php endif; ?>
So for my example,
A) Is my logic and code good/ideal?
B) Do I not need to include the following code, if I have the K2 item or category Extra Field parameter set to show?
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
Please Log in or Create an account to join the conversation.