- Posts: 3
COMMUNITY FORUM
K2 Call specific ExtraField in category_item.php
- Max Lang
- Topic Author
- Offline
- New Member
Less
More
7 years 10 months ago #158928
by Max Lang
K2 Call specific ExtraField in category_item.php was created by Max Lang
Hello,
iam trying to call some Specific ExtraFields to show in my Category_item.php
First of all i create an array:
than i try to call out one specific position. to show right after my Title with:
for exaple
Title of Category
<extrafield>
Author of Category
..
it does not work... in tag.php everything works just fine.
And yes i have activated ExtraField in category options.
iam trying to call some Specific ExtraFields to show in my Category_item.php
First of all i create an array:
<?php
$extraFld = array();
if ($item->extra_fields)
{
$extraFields = json_decode($item->extra_fields, false);
foreach ($extraFields as $key=>$extraField)
{
$extraFld[ $extraField->id ] = $extraField->value;
}
}
?>
than i try to call out one specific position. to show right after my Title with:
<?php echo $extraFld[4]; ?>
for exaple
Title of Category
<extrafield>
Author of Category
..
it does not work... in tag.php everything works just fine.
And yes i have activated ExtraField in category options.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 10 months ago #158931
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic K2 Call specific ExtraField in category_item.php
You can render a specific extrafield based on its alias
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L169-L173
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L169-L173
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Max Lang
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
7 years 10 months ago #159152
by Max Lang
Replied by Max Lang on topic K2 Call specific ExtraField in category_item.php
can u help me please? i dontknow how i need to set this code to get any result.
take for exaple the alias of one extrafield like PLZ and help me with the code please
take for exaple the alias of one extrafield like PLZ and help me with the code please
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 10 months ago #159158
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic K2 Call specific ExtraField in category_item.php
What is the code you used?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.