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?
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.
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.