1

I am creating a custom module in a warp7 master theme, and I want to get information from K2 that is used as a content management option.

I have created a sidebar and inserted a custom module (the one from helloworld tutorial). Now I want to have access k2 in there to get some specific extra field values to display.

Can you point me to what to do? I've managed to get the K2 Item id so far but I don't know how to get all the other information.

Thank you in advance

EDIT Inside helper.php of the module I am developing, I have this code:

public static function getHello($params) {
    $k2params = \K2HelperUtilities::getParams('com_k2');
    $mainframe = JFactory::getApplication();
    $id = JRequest::getInt('id'); // $id is the K2 item id
    return $id;
}
  • Can you please show some code and what you have already tried. You may want to look at the modules that get shipped with K2 to see how they get data – Lodder Mar 13 '15 at 9:46
  • I am rather new in K2 and Joomla, I've been using wordpress as my cms platform but I have to use Joomla on my new job as well. In wordpress you just get an item id and you call a get_post_meta (the equiv of the custom fields) function to get all custom fields. – Panagiotis Mar 13 '15 at 9:47
  • Also, K2 as it is takes data directly from mysql using queries. I was hoping that there was a method call or an api to get data on a higher level than that. – Panagiotis Mar 13 '15 at 9:53
1

So after some detailed view on mod_k2_content, I was able to get the method getItems and change it to getItem, and get a single parameterized item with some small tweaks and changes.

  • Can you share this please? – Max Sep 9 '15 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.