9 years 3 months ago
Hi there,
I am looking for ideas how to code the following k2 category template.
I want to show
a) the main category
b) a subcategory
c) items of the subcategory
d) then another subcategory with items
I know how the category.php loops through. It is this code here.
<?php if($this->params->get('subCategories') && isset($this->subCategories) && count($this->subCategories)): ?>
<!-- Subcategories -->
<div class="k2SubCategories">
<?php foreach($this->subCategories as $key=>$subCategory): ?>
What I want to do here is to check for e.g. a category alias or an category id. In case it is matching I want to call a different template for the subcategory and the items, display it and keep on looping for the second subcategory.
I have this code here which is for the category_item.php call.
<?php foreach($this->leading as $key=>$item): ?>
<?php
// Load category_item.php by default
$this->item=$item;
if($item->categoryalias == 'example') {
echo $this->loadTemplate('example')
} else {
echo $this->loadTemplate('item');
}
?>
<?php endforeach; ?>
I know that I have to do some hefty code changes to move the primary, secondary items into the subcategory listing.
However, my problem is even prior to that, as I cannot get the check for a particular subcategory id or alias to work.
Any suggestion, any link to a tutorial or idea for coding is appreciated.
thanks and best regards