Keyword

Latest items from (one or more) users or categorie

  • trogladyte
  • trogladyte's Avatar Topic Author
  • Offline
  • Senior Member
More
8 years 4 months ago #154203 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.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 4 months 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.
		<?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; ?>

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • trogladyte
  • trogladyte's Avatar Topic Author
  • Offline
  • Senior Member
More
8 years 4 months ago #154299 by trogladyte
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.

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

  • JoomlaWorks Support Team
  • JoomlaWorks Support Team's Avatar
  • Offline
  • Elite Member
More
8 years 4 months 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

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • trogladyte
  • trogladyte's Avatar Topic Author
  • Offline
  • Senior Member
More
8 years 4 months ago #154357 by trogladyte
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
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 4 months 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.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • trogladyte
  • trogladyte's Avatar Topic Author
  • Offline
  • Senior Member
More
8 years 4 months ago #154375 by trogladyte
Perfect! Thank you both - works great now!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 4 months ago #154410 by Krikor Boghossian
Replied by Krikor Boghossian on topic Latest items from (one or more) users or categorie
You 're welcome :)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum