Keyword

Templating - Placing Fields

  • Jens Lorentsen
  • Jens Lorentsen's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 7 months ago - 11 years 7 months ago #110537 by Jens Lorentsen
Templating - Placing Fields was created by Jens Lorentsen
Hi!
Im trying to customize my templates but K2 has all it's extra fields in one single place.
I would like to be able to place each extra field individually in my template.

Example:

Title
Image
Text
Some of the extra fields
A table with some of the extra fields.

Example here

Also i'd like to know if it's possible to have the same fields(s) more than one time in the templates.
Hope it makes sense.

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

More
11 years 7 months ago #110538 by Peter Grube
Replied by Peter Grube on topic Re: Templating - Placing Fields
Hi Jens,

You can include individual extra fields by adding your extra field alias to the code below, I am not sure about multiples of the same extra field, but you could try it & see. You are creating template overides presume ?
Log in  or Create an account to join the conversation.

  • Jens Lorentsen
  • Jens Lorentsen's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 7 months ago #110539 by Jens Lorentsen
Replied by Jens Lorentsen on topic Re: Templating - Placing Fields
Yes I am.

Thx for Your reply. I'll give it a go and return with the result.

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

  • Jens Lorentsen
  • Jens Lorentsen's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 7 months ago #110540 by Jens Lorentsen
Replied by Jens Lorentsen on topic Re: Templating - Placing Fields
I keep getting blank pages when i insert the code.
Which part of the line do I need to replace with my alias?

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

  • Jens Lorentsen
  • Jens Lorentsen's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 7 months ago - 11 years 7 months ago #110541 by Jens Lorentsen
Replied by Jens Lorentsen on topic Re: Templating - Placing Fields
This is what I'm trying to accomplish

To have my machine data on the top
To have specific data for each year in the table at the bottom.

So on first entering the user types in the main data and data for the first year.
Next year he comes back and adds data for the next year and so on.

Forgot a link :)
mk.jensl.dk/index.php/k2-artikel

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

  • Jens Lorentsen
  • Jens Lorentsen's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 7 months ago #110542 by Jens Lorentsen
Replied by Jens Lorentsen on topic Re: Templating - Placing Fields
I found this and it works:
getk2.org/documentation/tips-a-tricks/221-custom-admin-templates-and-calling-specific-extra-field-data

But it doesnt seem to be a very sound solution in the long run.
Imagine 10 years of data. That will give me 30 extra fields to add :(

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

More
11 years 7 months ago - 11 years 7 months ago #110543 by Peter Grube
Replied by Peter Grube on topic Re: Templating - Placing Fields
Hi Jens,
In the code I added, replace - Extra-Field-Alias (with your extrafields alias), I am using K2 2.6.5 & Joomla 2.5.9.

After looking at your site I think there maybe a more practical method, this code uses the existing K2 Extrafield block, but we can add a class to certain extrafields then hide them using CSS

Log in  or Create an account to join the conversation.