Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Control modules based on k2 item id

Control modules based on k2 item id

Hello,
i want to use for every K2 item page that i create a different module. Is there any solution.

Thank you

elvira2503
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Control modules based on k2 item id

Yes, you can do that quite easily, especially in the latest version of MetaMod (make sure you have the latest one) that has specific K2 support.

The PHP used could be this:

$k2 = JomGenius("k2");
if (! $k2->check("pagetype = item.view")) return; // do nothing if it's not an item page
$item_id = $k2->info("item_id");
if ($item_id == 10) return 100;
if ($item_id == 11) return 101;
if ($item_id == 12) return 102;
// add more as appropriate. the 2st number is the item id, and
// the 2nd number is the module to return for that item.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
3
User Info:
 
Total Users:
4421
Newest User:
rajajudi14
Members Online:
0
Guests Online:
107

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked