Keyword

Extra Fields In K2 Templates

  • Chris H
  • Chris H's Avatar Topic Author
  • Offline
  • New Member
More
13 years 3 months ago #97430 by Chris H
Extra Fields In K2 Templates was created by Chris H
Hi everyone,

 

I'm looking for a very straightforward description/tutorial on how to call individual extra fields into a K2 template.  I've been working on this issue for a while now, and haven't had any success.

 

We're attempting to put together a site that will allow the client to simply add their content to a series of extra fields, which will be preformatted by us with a number of different templates.  One of them for example, is a 'Celebrity of the Month' item.  We want to create a series of fields (Name, Age, Nationality, Eye Colour, etc), and then position the values within the main section of the article.

 

This is the code we were instructed to use to call our extra fields into our template.

 

echo $this->item->extra_fields[0]->value;

 

The instructions we were given simply said to adjust the field number to correspond with the required fields position in the back end editor.  This works for our first extra field [0], but we can't get any of our other fields to display at all.

 

If anyone has an idiot proof method for achieving what we're after, I'd be super keen on hearing about it.  Thanks, in advance.

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

More
13 years 3 months ago #97431 by william white
Replied by william white on topic Extra Fields In K2 Templates
This has worked for meYou may need to declare the array at the top of each override for it to work correctly

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

  • Chris H
  • Chris H's Avatar Topic Author
  • Offline
  • New Member
More
13 years 3 months ago #97432 by Chris H
Replied by Chris H on topic Extra Fields In K2 Templates
Hi William,

 

Thanks for your message.  I've done a fresh Joomla install this evening and managed to get the technique I mentioned above to work, so I suspect it may be a template/install issue with the version I'm using on the other project.  I'll be looking at it again in the morning, and will be sure to let you know how it goes.  Thanks again!

 

Cheers,

 

Chris

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


Powered by Kunena Forum