I am about to write a little plugin for K2 what enables the user to link Items/categories to items/categories. The backend part is working and I would like to load the items/categories in

public function onK2PrepareContent(&$item, &$params, $limitstart) {}

I have tried to load an Item like that:

private function loadItem($iid)
        $oid = JRequest::getInt('id');
        JRequest::setVar('id', $iid);

        $item = $this->itemModel->getData();
        $this->itemModel->prepareItem($item, 'item', '');

        JRequest::setVar('id', $oid);   
        $this->itemCache[$iid] = $item;
    return $this->itemCache[$iid];

But that throws some errors and seems not to work properly. Any Ideas I can load the Items and Category Objects?

Thanks in Ahead!

  • What errors it throws? What do you mean about "not working properly"?
    – Rene Korss
    Apr 9 '15 at 10:43
  • Are you getting errors while displaying the items in the frontend or while creating the links in the backend? I suppose this is supposed to be like a redirect plugin for K2? Sep 7 '16 at 1:53
  • This is an old one… The »little« Plugin became a big Plugi so the code to post is too much for here… With »linking« I mean, to append Items on one page. I finally made it work, all issues are gone.
    – philipp
    Sep 7 '16 at 9:08

Your Answer

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

Browse other questions tagged or ask your own question.