Keyword

[SOLVED] Category view, Items displayed as a table

  • angus reece
  • angus reece's Avatar Topic Author
  • Offline
  • New Member
More
9 years 1 month ago - 9 years 1 month ago #141713 by angus reece
Category view, Items displayed as a table was created by angus reece
i am trying to display a list of items in the category view.

I would like a header to each colum and for each item to be a new row in the table. I have tried to follow previous posts but have gone wrong some where.

I have changed category_item.php an this displays the table correctly, But the table is duplicated for each item im displaying so there are 4 copies of this table shown.
salefc.business-manchester.co.uk/index.php?option=com_k2&view=itemlist&layout=category&task=category&id=5&Itemid=161
<?php
/**
* @version 2.6.x
* @package K2
* @author JoomlaWorks www.joomlaworks.net
* @copyright Copyright (c) 2006 - 2014 JoomlaWorks Ltd. All rights reserved.
* @license GNU/GPL license: www.gnu.org/copyleft/gpl.html
*/

// no direct access
defined('_JEXEC') or die;
?>

<?php if($this->params->get('catTitle')): ?>
<!-- Category title -->
<h2><?php echo $this->category->name; ?><?php if($this->params->get('catTitleItemCounter')) echo ' ('.$this->pagination->total.')'; ?></h2>
<?php endif; ?>
<hr>
<?php if($this->params->get('catDescription')): ?>
<!-- Category description -->
<p><?php echo $this->category->description; ?></p>
<?php endif; ?>


<?php
$this->items = array_merge($this->leading, $this->primary, $this->secondary, $this->links);
?>

<!-- Start K2 Category Layout -->
<div id="k2Container" class="itemListView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>">
<div style= "color: #000;" class="table-responsive">
<table class="table table-striped" width="100%">

<th style="text-align: center; vertical-align: center;"><h6>Match</h6></th>
<th style="text-align: center; vertical-align: center;"><h6>Match Date</h6></th>
<th style="text-align: left; vertical-align: center;"><h6>Time</h6></th>
<th style="text-align: left; vertical-align: center;"><h6>Opponent</h6></th>
<th style="text-align: left; vertical-align: center;"><h6>Competition</h6></th>
<th style="text-align: right; vertical-align: center;"><h6>Result</h6></th>
</tr>
<?php foreach($this->items as $item): ?>
<tr>
<td style="text-align: left; width: 25%;"><a href="<?php echo $item->link; ?>"> <?php echo $item->title ;?></a></td>
<td style="text-align: center; width: 10%;"><?php echo $item->extraFields->MatchDate->value ;?></td>
<td style="text-align: right; width: 10%;"><?php echo $item->extraFields->Time->value ;?></td>
<td style="text-align: right; width: 10%;"><?php echo $item->extraFields->Opponent->value ;?></td>
<td style="text-align: right; width: 10%;"><?php echo $item->extraFields->Competition->value ;?></td>
<td style="text-align: right; width: 10%;"><?php echo $item->extraFields->Result->value ;?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
<!-- Pagination -->
<?php if(count($this->pagination->getPagesLinks())): ?>
<div class="k2Pagination pagination pagination-mini">
<?php if($this->params->get('catPagination')) echo $this->pagination->getPagesLinks(); ?>
<div class="clr"></div>
<?php if($this->params->get('catPaginationResults')) echo $this->pagination->getPagesCounter(); ?>
</div>
<?php endif; ?>

</div>
</div>
<!-- End K2 Category Layout -->

Does any one know what im doing wrong?
Last edit: 9 years 1 month ago by angus reece. Reason: spelling

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

  • angus reece
  • angus reece's Avatar Topic Author
  • Offline
  • New Member
More
9 years 1 month ago #141715 by angus reece
Replied by angus reece on topic Category view, Items displayed as a table
a soon as i posted this of course if found the answer. im editing thevwrong file.
www.joomlaworks.net/forum/k2-en/40019-category-view-sub-theme#140503.

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


Powered by Kunena Forum