- Posts: 69
COMMUNITY FORUM
Directory Listing K2 items in a table w/ columns
- Justin Place
- Topic Author
- Offline
- Senior Member
I want to display all the listings (K2 items) on a simple table with some columns:
Column 1: Listing name
Column 2: Contact Number
Column 3: Further details - "View profile" link
Quite similar to this table:
imageshack.us/a/img541/8485/bedandbreakfastspage.png
Is this possible with a K2 extension, preferably non-commercial, since iv already purchased modules for K2.
Kind regards
Justin
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
It is possible if you override category.php and category_item.php and you are familiar with simple coding.
Inside category.php outside the items loop (foreach) you have to open and close your <table> element.
Now open category_item.php. Insert a <tr> element on top and close it at the end.
Show your content inside <td> elements. Use one td for the title and one for each of your extrafields. For more information on rendering extrafields you should read this post .
getk2.org/community/New-to-K2-Ask-here-first/171284-Where-to-edit-K2-after-Item-Fields#171348
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Justin Place
- Topic Author
- Offline
- Senior Member
- Posts: 69
Thanks for the reply.
I'm not sure where category.php & category_item.php files would be?
I am relatively okay with php in some aspects, but could you give me an example please of what i must edit to get it correct?
sorry if i am being a pain?
maybe it will help others who don't know much to guide them in the right direction.
Kind regards,
Justin
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
- Offline
- Platinum Member
- Joomla Developer
category.php and category_item.php can be found inside components/com_k2/templates/default folder.
But you need to read more about templates overrides before starting this modifications, you can read this document for more details: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Justin Place
- Topic Author
- Offline
- Senior Member
- Posts: 69
But you need to read more about templates overrides before starting this modifications, you can read this document for more details: getk2.org/documentation/tutorials/174-te...pts-of-sub-templates
Thanks!! I read that and followed the instructions there.
I have made a duplicate of the "default" folder in my JoomlaTemplate/html/com_k2
called "Listing page" which will be the template for all my listings.
Pretty cool.
I found this link very helpful! maybe it will help others : www.modernmagic.com/blog/joomla-technical-support/k2-table-like-list-in-category-view.html
Ill give it a shot and see how it goes..
Kind regards
Please Log in or Create an account to join the conversation.
- Justin Place
- Topic Author
- Offline
- Senior Member
- Posts: 69
I don't think I am inserting the <table> code in the right place, because its not showing after I have assigned the category template to my custom one:
<!-- Item list -->
<table>
<div class="itemList">
<?php if(isset($this->leading) && count($this->leading)): ?>
<!-- Leading items -->
<div id="itemListLeading">
<?php foreach($this->leading as $key=>$item): ?>
<?php
// Define a CSS class for the last container on each row
if( (($key+1)%($this->params->get('num_leading_columns'))==0) || count($this->leading)<$this->params->get('num_leading_columns') )
$lastContainer= ' itemContainerLast';
else
$lastContainer='';
?>
<div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->leading)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_leading_columns'), 1).'%;"'; ?>>
<?php
// Load category_item.php by default
$this->item=$item;
echo $this->loadTemplate('item');
?>
</div>
<?php if(($key+1)%($this->params->get('num_leading_columns'))==0): ?>
<div class="clr"></div>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<table>
And <tr> for the category_item.php is inserted at the top and bottom of the item-layout?
I don't think I'm understanding the template override that well :( :blush:
kind regards
Justin
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
- Offline
- Platinum Member
- Joomla Developer
I think you missed a folder in the template override structure, your templates should be under: JoomlaTemplate/html/com_k2/templates
Try to add the templates folder, I think it will work.
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Justin Place
- Topic Author
- Offline
- Senior Member
- Posts: 69
Im quite sure the folder is like you said MyTemplate/html/com_k2/Templates/Listing Page
I assigned the category item layout to "Listing Page"
but theres no layout that's changed.
What do you think I'm doing wrong or missing to add?
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
- Offline
- Platinum Member
- Joomla Developer
Do you enter folder names as you write in this post?
I mean "Listing Page" with space between words?
Try to not use space, and also rename the folder Templates to templates, if you used capital letter 'T'
Let me if this solved the problem.
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Justin Place
- Topic Author
- Offline
- Senior Member
- Posts: 69
still no luck.
here is one of the listing pages - www.borderlearning.justrite.co.za/index.php/component/k2/itemlist/category/9-bnb
Please Log in or Create an account to join the conversation.