Keyword

Display Extra fields by ID in templates

  • tarik916
  • tarik916's Avatar Topic Author
  • Offline
  • New Member
More
15 years 7 months ago #75830 by tarik916
Display Extra fields by ID in templates was created by tarik916
The ability to display custom fields by field ID rather than array number would be great.

$extra_fields[22]->output; or something other than $this->item->extra_fields[2]->value;

The current version works well unless you modify the sort of the extra fields.

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

More
13 years 10 months ago #75831 by Donovan Ryan Hay
Replied by Donovan Ryan Hay on topic Display Extra fields by ID in templates
Put the following at the top of your page:


<?php//convertArray to use ids as key$customExtraFields = array();foreach($this->item->extra_fields as $item){    $customExtraFields[$item->id] = $item->value;}?>

 

 

Use the following to call the extra field via its id:


<?php //echo out id valueecho $customExtraFields[3]; ?>

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


Powered by Kunena Forum