Keyword

Different DIV for Value of ExtraFields?

  • aobodoe
  • aobodoe's Avatar Topic Author
  • Offline
  • New Member
More
11 years 2 months ago #116287 by aobodoe
Dear,

I need to define two different value of ExtraFields of K2, for example "price" and "link for buy", and I need to define two different DIV for different value. However, there are only one PHP's function to output value.

Following are codes:
<span class="catItemExtraFieldsValue"><?php echo $extraField->value; ?></span>

QUESTION: How to define two different DIV for two Value of ExtraFields?

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
11 years 2 months ago #116288 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: Different DIV for Value of ExtraFields?
I think you need to display extra fields one by one, not a loop like the default.

if so, replace the code of displaying extra fields as below
for the field label/name, use this:
<?php echo $this->item->extraFields->fieldAlias->name ; ?>

for the field value, use this:
<?php echo $this->item->extraFields->fieldAlias->value ; ?>

where you get the fieldAlias from the extra fields manager in the backend.

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.


Powered by Kunena Forum