Keyword

Related items with first article images?

  • zecaffe
  • zecaffe's Avatar Topic Author
  • Offline
  • New Member
More
8 years 9 months ago #150156 by zecaffe
I ve noticed that there is no option in category-- item view -- for related items to load "first article image" .. We can only choose manualy uploaded images in article from tab "Images" ...

What i need is to load automatically first item image ... that option is available in gavick news show 5 module ... and is very usefull.

Btw, is there any "Related items module for k2" ??

Thank you.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 9 months ago #150170 by Krikor Boghossian
Replied by Krikor Boghossian on topic Related items with first article images?
In the related items, the K2 images is being loaded by default.
To ensure that you have the ultimate control over the layout, you are highly encouraged to use K2's image instead of the editor for images.

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

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

  • zecaffe
  • zecaffe's Avatar Topic Author
  • Offline
  • New Member
More
8 years 9 months ago - 8 years 9 months ago #150201 by zecaffe
Replied by zecaffe on topic Related items with first article images?
In my case images are not loaded automatically.

Demo: www.slusam.net/component/k2/technobase-fm

Available options are : "none selected, xsmall, large .. etc"

Settings in k2 -- category -- Item view is :

As you can see, it laods ony image from the article where i have uploaded image manually in the "Image tab" ... :

Notice: every article has image inside content.

I want, to load first content image in related items listing if its possible ... maybe "little" code hack in /components/com_k2/templates/stanice/item.php could help to force loading first article image?
<?php if($this->item->params->get('itemRelated') && isset($this->relatedItems)): ?>
  <!-- Related items by tag -->
	<div class="itemRelated">
		<h3><?php echo JText::_("K2_RELATED_ITEMS_BY_TAG"); ?></h3>
		<ul>
			<?php foreach($this->relatedItems as $key=>$item): ?>
			<li class="<?php echo ($key%2) ? "odd" : "even"; ?>">

				<?php if($this->item->params->get('itemRelatedTitle', 1)): ?>

				<a class="itemRelTitle" href="<?php echo $item->link ?>"><?php echo $item->title; ?></a>
				<?php endif; ?>

				<?php if($this->item->params->get('itemRelatedCategory')): ?>
				<div class="itemRelCat"><?php echo JText::_("K2_IN"); ?> <a href="<?php echo $item->category->link ?>"><?php echo $item->category->name; ?></a></div>
				<?php endif; ?>

				<?php if($this->item->params->get('itemRelatedAuthor')): ?>
				<div class="itemRelAuthor"><?php echo JText::_("K2_BY"); ?> <a rel="author" href="<?php echo $item->author->link; ?>"><?php echo $item->author->name; ?></a></div>
				<?php endif; ?>

				<?php if($this->item->params->get('itemRelatedImageSize')): ?>
			
				<img style="width:<?php echo $item->imageWidth; ?>px;height:auto;" class="itemRelImg" src="<?php echo $item->image; ?>" alt="<?php K2HelperUtilities::cleanHtml($item->title); ?>" />
				<?php endif; ?>

				<?php if($this->item->params->get('itemRelatedIntrotext')): ?>
				<div class="itemRelIntrotext"><?php echo $item->introtext; ?></div>
				<?php endif; ?>

				<?php if($this->item->params->get('itemRelatedFulltext')): ?>
				<div class="itemRelFulltext"><?php echo $item->fulltext; ?></div>
				<?php endif; ?>

				<?php if($this->item->params->get('itemRelatedMedia')): ?>
				<?php if($item->videoType=='embedded'): ?>
				<div class="itemRelMediaEmbedded"><?php echo $item->video; ?></div>
				<?php else: ?>
				<div class="itemRelMedia"><?php echo $item->video; ?></div>
				<?php endif; ?>
				<?php endif; ?>

				<?php if($this->item->params->get('itemRelatedImageGallery')): ?>
				<div class="itemRelImageGallery"><?php echo $item->gallery; ?></div>
				<?php endif; ?>
			</li>
			<?php endforeach; ?>
			<li class="clr"></li>
		</ul>
		<div class="clr"></div>
	</div>
	<?php endif; ?>

	<div class="clr"></div>


Thank you for answer.
Regards.
Last edit: 8 years 9 months ago by zecaffe.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 9 months ago - 8 years 9 months ago #150216 by Krikor Boghossian
Replied by Krikor Boghossian on topic Related items with first article images?
First of all, you should use overrides instead of editing core files because you risk losing your edits when you update.

getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

As for the image you can try
<?php if($this->item->params->get('itemRelatedImageSize') && !empty($item->image)  ): ?>

instead of:
<?php if($this->item->params->get('itemRelatedImageSize')): ?>

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 8 years 9 months ago by Krikor Boghossian.

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

  • zecaffe
  • zecaffe's Avatar Topic Author
  • Offline
  • New Member
More
8 years 9 months ago - 8 years 9 months ago #150219 by zecaffe
Replied by zecaffe on topic Related items with first article images?
I am already useing k2 subtemplate named "stanice," but i created it inside the k2 component folder www.slusam.net/components/com_k2/templates/stanice/item.php . I should not have problems with updateing k2 ?

I changed that part of code, but no results ... you can see the demo again...


Thanks for answer.
Regards.
Last edit: 8 years 9 months ago by zecaffe.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 9 months ago #150222 by Krikor Boghossian
Replied by Krikor Boghossian on topic Related items with first article images?
imgur.com/k9DTYVL
It seems to be working fine.

Also, yes it is highly recommended to use the default method of overriding.

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

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

  • zecaffe
  • zecaffe's Avatar Topic Author
  • Offline
  • New Member
More
8 years 9 months ago #150231 by zecaffe
Replied by zecaffe on topic Related items with first article images?
It does not work. It loads only image from the article "Electronic Global" wich is uploaded inside Image tab. Pictures for other 4 articles were not loaded, even they have pictures inside k2 content.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 9 months ago #150235 by Krikor Boghossian
Replied by Krikor Boghossian on topic Related items with first article images?
This does not have an image www.slusam.net/component/k2/technobase-fm

nor does this: www.slusam.net/component/k2/costa-del-mar and www.slusam.net/component/k2/feevermix

There is no K2 image set on those items.

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

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

  • zecaffe
  • zecaffe's Avatar Topic Author
  • Offline
  • New Member
More
8 years 9 months ago #150244 by zecaffe
Replied by zecaffe on topic Related items with first article images?
Those items have images inside content

prntscr.com/9i5mcf
prntscr.com/9i5l9j
prntscr.com/9i5m46

Is it possible to load those pictures from content in related items list?? If i want pictures in related items i must upload again image in "Image tab" for every article. Thats booring.

Thank you.

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

More
8 years 9 months ago #150264 by Lefteris
Replied by Lefteris on topic Related items with first article images?
@zecaffe

K2 will load item's text in related items list if you set it to do it. So ensure that item text is set to be displayed and that you do not apply any word limit to it. Just check the options again.

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