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.

 

Recipe for K2 Attachments

Recipe for K2 Attachments

I am trying to combine show a module with K2 attachment links in the sidebar of my blog on every K2 Item that HAS an attachment.  Regularly, the module would show on every K2 Item regardless of whether there was an attachment associated with the displayed Item.

Theoretically, this should be possible using metamod, which I've used successfully for other purposes.  Does anyone know the proper syntax for referencing K2 attachments???

xaashley
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Recipe for K2 Attachments

Hi, can I assume that this is on J2.5? Just off to look at the database structure to work out how to detect it...

Stephen

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
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Recipe for K2 Attachments

On J2.5, try it this way:

if (
  $option == 'com_k2'
  and $view == 'item'
) {
  $newid = (int)$id;
  $query = 'select itemID from #';
  $query .= '__k2_attachments where itemId = ' . $newid;
  $db->setQuery($query);
  $result = $db->loadResult();
  if ($result) return XXX;
  // replace XXX with the module ID of the K2 content module.
  // the target module will only show if you are on a K2 item view
  // page for an item with an attachment on it.
}

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
3329 Posts
User info in posts
Administrator has disabled public posting

Re: Recipe for K2 Attachments

Yes, it was for J2.5 and that worked perfectly!  Thank you so much!!!

xaashley
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1685
Total Polls:
6
Total Posts:
5940
Posts this week:
1
User Info:
 
Total Users:
5193
Newest User:
david2398
Members Online:
1
Guests Online:
186

Online: 
Technichem

Forum Legend:

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