Keyword

Related Items

  • Eyal Kattan
  • Eyal Kattan's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 9 months ago #60967 by Eyal Kattan
Related Items was created by Eyal Kattan
Hi All,

I am new to K2 so please spare me if I ask stupid questions. ;-)

I am trying to create a TAG based related items. I saw that by default, K2 shows the related items at the bottom of the page, right below the content area.

I am using a template that has a special position that I would like to use for the related items. How can I change the assigned position of the related items to the one defined by the template?

Or alternatively, I created a module that shows a category in this position but it doesn't filter the items based on Tags. Would it be easier to add filtration to this module? and how do I do this?

Thanks in advance.

-Eyal

Eyal Kattan
Owner
MEDIA NEXUS INC

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

  • Eyal Kattan
  • Eyal Kattan's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 9 months ago #60968 by Eyal Kattan
Replied by Eyal Kattan on topic Re: Related Items
Anyone can help?

Eyal Kattan
Owner
MEDIA NEXUS INC

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

  • Eyal Kattan
  • Eyal Kattan's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 9 months ago - 12 years 9 months ago #60969 by Eyal Kattan
Replied by Eyal Kattan on topic Re: Related Items
Ok, let try a different approach.

I created a new K2-Tools module for custom code. I copied the following code from item.php into the custom code text field in the module.

Now the page crashes in the browser. Obviously I'm missing something.

Can anyone help?

Thanks,

Eyal





<?php if($this->item->params->get('itemRelated') && isset($this->relatedItems)): ?>
<!-- Related items by tag -->
<ul>
<?php foreach($this->relatedItems as $key=>$item): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?>">

<?php if($this->item->params->get('itemRelatedImage')): ?>
<div class="itemRelImage"><?php echo $item->image; ?></div>
<?php endif; ?>

<?php if($this->item->params->get('itemRelatedTitle', 1)): ?>
<a class="itemRelTitle" href="<?php echo $item->link ?>"><?php echo $item->title; ?></a>
<?php endif; ?>
</li>
<?php endforeach; ?>
<li class="clr"></li>
</ul>

Eyal Kattan
Owner
MEDIA NEXUS INC

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

  • Andrey Miasoedov
  • Andrey Miasoedov's Avatar
  • Offline
  • Senior Member
More
12 years 9 months ago #60970 by Andrey Miasoedov
Replied by Andrey Miasoedov on topic Re: Related Items
Hello, Eyal.

Your last idea is not a true way, try DM K2 Related Articles module.

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

  • Eyal Kattan
  • Eyal Kattan's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 9 months ago - 12 years 9 months ago #60971 by Eyal Kattan
Replied by Eyal Kattan on topic Re: Related Items
Hi Andrey,

Thanks for your reply. Unfortunately I can't spend any more $$ on plug-ins because it feels like it just lead to purchasing another plugin and another plug-in.

The functionality I'm seeking is already in the basic K2 so I assumed it shouldn't be so hard to tweak it as I need. I even created an item page that shows the related items only. But when trying to use this template as sub-template, the page crashes. In fact, any template I use as sub-template in the module, even the default, crashes the page.

I am new to K2 and would like to better understand how it works and how it can be tweaked before I spend more money on plug-ins. But unfortunately there is no documentation and support on this forum has not showed it self yet. I apologize if I sound frustrated, but I am.

Eyal Kattan
Owner
MEDIA NEXUS INC

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

  • Eyal Kattan
  • Eyal Kattan's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 9 months ago #60972 by Eyal Kattan
Replied by Eyal Kattan on topic Re: Related Items
Really no one can help with this?

Eyal Kattan
Owner
MEDIA NEXUS INC

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

  • Andrey Miasoedov
  • Andrey Miasoedov's Avatar
  • Offline
  • Senior Member
More
12 years 9 months ago #60973 by Andrey Miasoedov
Replied by Andrey Miasoedov on topic Re: Related Items
You can use jQuery to replace related items to special position.

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

  • Eyal Kattan
  • Eyal Kattan's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 9 months ago #60974 by Eyal Kattan
Replied by Eyal Kattan on topic Re: Related Items

Andrey Miasoedov wrote: You can use jQuery to replace related items to special position.


IThanks for your reply Andrey. Since I'm relatively new to Joomla and K2 , can you ellaborate on how to do this? or post some links...

Thanks in advance

Eyal

Eyal Kattan
Owner
MEDIA NEXUS INC

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

  • Andrey Miasoedov
  • Andrey Miasoedov's Avatar
  • Offline
  • Senior Member
More
12 years 9 months ago #60975 by Andrey Miasoedov
Replied by Andrey Miasoedov on topic Re: Related Items
In your template's index.php, in <head> section add the following :

<script>

jQuery.noConflict();

jQuery(document).ready(function() {

var related = jQuery("div.itemRelated").html();
jQuery("div.itemRelated").html("");
jQuery("div.newItemRelated").html("<div class='itemRelated'>" + related + "</div>");

});

</script>

Relpace red text with your position container.

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

  • Eyal Kattan
  • Eyal Kattan's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 8 months ago - 12 years 8 months ago #60976 by Eyal Kattan
Replied by Eyal Kattan on topic Re: Related Items
doesn't seem to work. I think it is because the container into which I want to enter the related items html (according to your code) is only created if there is an actual module assigned to it.

Here is the code where it is getting created:

<?php if($this->countModules('position-45')): ?>
<div class="row1">
<jdoc:include type="modules" name="position-45" style="xhtml"/>
</div>
<?php endif; ?>


On another note, I may be aiming too high, but how complicated would it be to create a separated K2 component for Related Items? Then I can just use the Joomla admin interface to create a module and assign it to the Related Items component and the position I need.

Another thought, it seems like the related items could fit perfectly in the K2 Tools as an additional source type.

This way, I don't need to hard code the related items into the specific container.

Any thoughts?

Eyal Kattan
Owner
MEDIA NEXUS INC

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


Powered by Kunena Forum