Keyword

k2_content dynamic itemid problem

More
12 years 6 months ago - 12 years 6 months ago #64089 by Simon
k2_content dynamic itemid problem was created by Simon
Hello,

I'm trying to make the com_k2_content module pull itemid equivalent to the itemid of the loaded page.

Let's say I have an item page for idHenry and an item page for idBobby. I want the com_k2_content to only pull data from the idBobby dataset for my idBobby page, and only pull idHenry data for the idHenry page.

Now, I can configure the item view options to do this easily enough and I'd need to create a specific instance of the module for each of them. So I would have two instances of the module running.

This isn't a problem when you only have a small number of pages as you can make a module instance that pulls specific data for each one. The problem is when you have 100s or 1000s of items like this. It isn't practical to create hundreds or thousands of instances of the com_k2_content module each tailored to a specific itemid. There must be some dynamic way of pulling the data?


I am sure there must be some php code change I can put into the mod_k2_content.php or it's helper.php file to load only data from the itemid of the page it is pulled from but I don't know what or where it is. So instead of looping through the entire Array of a categories items, it only finds the data for the page it is called from.

Is it possibly somewhere in this piece of code from the helper.php?
        if ($params->get('source') == 'specific')
                {

                        $value = $params->get('items');
                        $current = array();
                        if (is_string($value) && !empty($value))
                                $current[] = $value;
                        if (is_array($value))
                                $current = $value;

My hunch is that I need to change something in this code. What if I changed $current = array(); part to something like $current = $id; ? I'm unsure of the syntax.


Thanks for any help, K2 is a brilliant piece of kit.

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

More
12 years 6 months ago #64090 by Simon
Replied by Simon on topic Re: k2_content dynamic itemid problem
I am still fiddling around with this, maybe I need to change something in this line for the mod_k2_content helper.php
			$query = "SELECT i.*, CASE WHEN i.modified = 0 THEN i.created ELSE i.modified END as lastChanged, c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams";

How do I make it only pull the row for the itemID of the page the module is on?

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

More
12 years 6 months ago - 12 years 6 months ago #64091 by Simon
Replied by Simon on topic Re: k2_content dynamic itemid problem
Nevermind, I have found an extension that will do exactly what I need. For anyone interested:

extensions.joomla.org/extensions/extension-specific/k2-extensions/13890

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


Powered by Kunena Forum