Keyword

[SOLVED] Specific Extra Fields in tag.php

  • Andrew Paterson
  • Andrew Paterson's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 11 months ago #133155 by Andrew Paterson
Specific Extra Fields in tag.php was created by Andrew Paterson
Hi All

I'd like to place specific extra fields in my template override for tag.php. I've tried this:
Log in  or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 11 months ago #133156 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Specific Extra Fields in tag.php
Hello Andrew,

You should use $item instead of $this->item for the tag layout.

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

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

  • Andrew Paterson
  • Andrew Paterson's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 11 months ago #133157 by Andrew Paterson
Replied by Andrew Paterson on topic Re: Specific Extra Fields in tag.php
Working perfectly- thank you!

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

More
9 years 8 months ago #135738 by MessageDJ
Replied by MessageDJ on topic Specific Extra Fields in tag.php
i have no clue why, but nothing shows when i add this.
<?php if($this->item->extraFields->Duration->value != ''): ?>
      <?php echo $this->item->extraFields->Duration->name ?>
<?php echo $this->item->extraFields->Duration->value ?>

my site contains all sorts of Trips, and the Extrafield i like to show in the TagView is Duration. The extrafield Alias is called " Duration" i added this code after the title.

should i add some more code in the head or something?

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

More
9 years 8 months ago #135739 by MessageDJ
Replied by MessageDJ on topic Specific Extra Fields in tag.php
already found it.....
<?php $extrafields = json_decode($item->extra_fields);?>
<?php foreach($extrafields as $key=>$value): ?>
<?php if($extrafields[$key]->id == 'EXTRA_FIELD_ID_NR'&&$extrafields[$key]->value!=''): ?>
<?php echo $extrafields[$key]->value; ?>,
<?php endif; ?> 
<?php endforeach; ?>

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 8 months ago #135760 by Krikor Boghossian
Replied by Krikor Boghossian on topic Specific Extra Fields in tag.php
Thank you for sharing the solution :)

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

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