- Posts: 61
COMMUNITY FORUM
Latest items from (one or more) users or categorie
- trogladyte
-
Topic Author
- Offline
- Senior Member
Less
More
9 years 6 days ago #154203
by trogladyte
Latest items from (one or more) users or categorie was created by trogladyte
ckdev.info/twt/
I have set the Home item to "Latest items from (one or more) users or categories". I have 6 categories which I am displaying the latest article from (one article per category). This all works fine. In the menu item under Options | Category Settings, I have "Image" set to "Show". And it does. However, it's not linked to the category.
Have I missed something or is this not available in K2? If I use "Item listings » Categories" then the ability to show and link those category icons exists and I have it working. Thanks.
I have set the Home item to "Latest items from (one or more) users or categories". I have 6 categories which I am displaying the latest article from (one article per category). This all works fine. In the menu item under Options | Category Settings, I have "Image" set to "Show". And it does. However, it's not linked to the category.
Have I missed something or is this not available in K2? If I use "Item listings » Categories" then the ability to show and link those category icons exists and I have it working. Thanks.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 4 days ago #154251
by Krikor Boghossian
Replied by Krikor Boghossian on topic Latest items from (one or more) users or categorie
You can do this in your overrides.
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
This code will produce the image with a link towards the category.
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
This code will produce the image with a link towards the category.
<?php if ($this->params->get('categoryImage') && !empty($category->image)): ?>
<div class="latestItemsCategoryImage">
<a href="<?php echo $category->link; ?>">
<img src="<?php echo $category->image; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($category->name); ?>" style="width:<?php echo $this->params->get('catImageWidth'); ?>px;height:auto;" />
</a>
</div>
<?php endif; ?>
Please Log in or Create an account to join the conversation.
- trogladyte
-
Topic Author
- Offline
- Senior Member
Less
More
- Posts: 61
9 years 2 days ago #154299
by trogladyte
Replied by trogladyte on topic Latest items from (one or more) users or categorie
Thanks Krikor. It would be helpful to know which file this is to go in and whether it replaces some - if so what - and if not, where it goes. Front of the file, end...
Unfortunately, not all of us are code savvy, so, knowing where to go to use the code is essential.
Unfortunately, not all of us are code savvy, so, knowing where to go to use the code is essential.
Please Log in or Create an account to join the conversation.
- JoomlaWorks Support Team
-
- Offline
- Elite Member
Less
More
- Posts: 169
9 years 2 days ago #154311
by JoomlaWorks Support Team
Replied by JoomlaWorks Support Team on topic Latest items from (one or more) users or categorie
Hi,
The file should be at
/templates/[YOURTEMPLATE]/html/com_k2/[YOURK2TEMPLATE]/latest.php
The file should be at
/templates/[YOURTEMPLATE]/html/com_k2/[YOURK2TEMPLATE]/latest.php
Please Log in or Create an account to join the conversation.
- trogladyte
-
Topic Author
- Offline
- Senior Member
Less
More
- Posts: 61
9 years 1 day ago #154357
by trogladyte
Replied by trogladyte on topic Latest items from (one or more) users or categorie
Well, I put it in near the beginning - no idea if that's where it should go as nothing was said as to its location in the file. It doesn't work, so I suspect it's in the wrong place.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 1 day ago #154365
by Krikor Boghossian
Replied by Krikor Boghossian on topic Latest items from (one or more) users or categorie
Look into the code for this part,
<?php if ($this->params->get('categoryImage') && !empty($category->image)): ?>
This will help you locate the image. Once you locate that block, replace it with the code I gave you.
<?php if ($this->params->get('categoryImage') && !empty($category->image)): ?>
This will help you locate the image. Once you locate that block, replace it with the code I gave you.
Please Log in or Create an account to join the conversation.
- trogladyte
-
Topic Author
- Offline
- Senior Member
Less
More
- Posts: 61
9 years 1 day ago #154375
by trogladyte
Replied by trogladyte on topic Latest items from (one or more) users or categorie
Perfect! Thank you both - works great now!
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 4 hours ago #154410
by Krikor Boghossian
Replied by Krikor Boghossian on topic Latest items from (one or more) users or categorie
You 're welcome :)
Please Log in or Create an account to join the conversation.