kricore/Advanced-templating-with-K2

Using the new category.php code - still pulls items from category_item.php

Closed this issue · 4 comments

Hi Kricore,

I've been trying to get some of the new templating to work and I'm assuming that the code that is meant to pull the category item list is this:

<?php if(count($this->items)): ?>
    <div class="itemList">
        <?php foreach($this->items as $item): ?>
            <?php $this->item = $item; echo $this->loadItemlistLayout(); ?>
        <?php endforeach; ?>
    </div>
<?php endif; ?> 

I'm assuming that it is supposed to pull itemlist.php and/or itemlist_item.php - but instead it still seems to be pulling category_item.php.

Actually the opposite Kelsey.
xxx_item will always be used before itemlist_item.php if they are present.
Eg: If tag_item is present is used instead of itemlist_item.php

If you remove category_item.php then the itemlist_item.php will be used instead.

That doesn't seem to be the case on the site I'm working on.

Here's the com_k2 override folder which is just the contents of the BEM folder from these demo files:

https://www.dropbox.com/s/3mmda6ohgkun5u2/Screenshot%202015-09-22%2008.24.20.png?dl=0

I've assigned that override to a category and this is the result:

https://www.dropbox.com/s/m6e3ydzs524ija5/Screenshot%202015-09-22%2008.26.29.png?dl=0

That's definitely still pulling category_item.php, although category_item.php is not in the override folder.

If category_item.php is present in the default it will be pulled from there.
You can remove it from the default folder or the /components/com_k2/templates/ folder to make your overrides simpler.

I am closing this issue now. Feel free to reopen it, if you run into any difficulties.