Keyword

How to display all extra fields in table format

More
11 years 4 weeks ago - 11 years 3 weeks ago #112152 by Peter
I am building a school guide. I have already populated my K2 with many items which have 9 extra fields. The K2 items don't carry any content. The extra fields are the real content. Right now all items including extra fields are displayed each on separate lines. I have already discovered in the template that "<ul>" and "<li>" HTML tags are used in the standard K2 installation.

I want to display all extra fields in a visual table format like (without using the table HTML tag):
[tr]
[td]Extra Field Name 1[/td]
[td]Extra Field Name 2[/td]
[td]Extra Field Name 3[/td]
[/tr]

[tr]
[td]Item1 - Data Extra Field 1[/td]
[td]Item1 - Data Extra Field 2[/td]
[td]Item1 - Data Extra Field 3[/td]
[/tr]
[tr]
[td]Item2 - Data Extra Field 1[/td]
[td]Item2 - Data Extra Field 2[/td]
[td]Item2 - Data Extra Field 3[/td]
[/tr]
[tr]
[td]Item3 - Data Extra Field 1[/td]
[td]Item3 - Data Extra Field 2[/td]
[td]Item3 - Data Extra Field 3[/td]
[/tr]
[tr]
[td]Item4 - Data Extra Field 1[/td]
[td]Item4 - Data Extra Field 2[/td]
[td]Item4 - Data Extra Field 3[/td]
[/tr]
[tr]
[td]Item5 - Data Extra Field 1[/td]
[td]Item5 - Data Extra Field 2[/td]
[td]Item5 - Data Extra Field 3[/td]
[/tr]
[tr]
[td]Item6 - Data Extra Field 1[/td]
[td]Item6 - Data Extra Field 2[/td]
[td]Item6 - Data Extra Field 3[/td]
[/tr]


Does K2 core offer this functionality, and if yes, how do I use it?

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

More
11 years 2 weeks ago #112153 by Odin Mayland
Replied by Odin Mayland on topic Re: How to display all extra fields in table format
You can place code in a k2 subtemplate that formats the category.php to display like what you want.

Here is an example of what I have done. Each column is a specific extra field from the k2 items that are displayed in rows.

Attachment not found

Attachments:

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

More
11 years 2 weeks ago #112154 by Peter
Many thanks for your reply! That is what I am looking for! Can your share the php code so that I can use that as a base?

Q: Do you also know how to make the row clickable to display all information of the item including teh extra fields?

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

More
11 years 2 weeks ago #112155 by Odin Mayland
Replied by Odin Mayland on topic Re: How to display all extra fields in table format
Peter,

Here is a complete write up on how to create the list:
www.modernmagic.com/blog/joomla-technical-support/k2-table-like-list-in-category-view.html

A. The k2 item title is clickable but the extrafields are not unless you make each extrafield value have a href. I would make it obvious with css styling that the user should click the item title to see the whole k2 item and all extrafields that you may not have shown in this list.

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

More
11 years 1 week ago #112156 by Peter
Many thanks for the detailed instructions. You rock! :)

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

More
11 years 1 week ago #112157 by Odin Mayland
Replied by Odin Mayland on topic Re: How to display all extra fields in table format
You're welcome.

If I made a mistake or you need more details just reply here or comment directly on that blog post.

I will be launching the site that is using this table format soon. So check back on that blog site link in a week or so....

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

More
11 years 1 week ago #112158 by Stephan Tensen
Replied by Stephan Tensen on topic Re: How to display all extra fields in table format
Thanks for the nice tutorial. I only had some problems getting the CSS working. I had to change your standard <div> to <div class="extrafieldscolumns">. After that it was very nice.

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

More
11 years 1 week ago #112159 by Odin Mayland
Replied by Odin Mayland on topic Re: How to display all extra fields in table format
Thank you for catching that mistake. I have fixed it.

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


Powered by Kunena Forum