Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

CKJModel get instance not working from the plugin 07 Sep 2014 05:21 #12613

  • vivek
  • vivek's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 123
  • Thank you received: 2
Hi,
I had followed the below article to access a model from the plugin.

www.j-cook.pro/index.php/m/module

It gives non object error on this line.

@include_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_cskpro'.DS.'helpers'.DS.'loader.php');
$model = CkJModel::getInstance('User', 'CskPro');
$item = $model->getItem();

However, the same code works fine on the component which was generated by cook an year back.Did something change recently?

Regards
Vivek

Please Log in or Create an account to join the conversation.

CKJModel get instance not working from the plugin 09 Sep 2014 16:22 #12615

  • vivek
  • vivek's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 123
  • Thank you received: 2
Any replies ?? Got stuck with this for few days now..

Regards
Vivek

Please Log in or Create an account to join the conversation.

CKJModel get instance not working from the plugin 09 Sep 2014 16:23 #12616

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Sorry for late answer.
I am gonna check this soon.

Did you tried on fresh install ?
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

CKJModel get instance not working from the plugin 09 Sep 2014 16:40 #12617

  • vivek
  • vivek's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 123
  • Thank you received: 2
Solved it by myself..

Here are the lines I had added to the loader.php

// Set the models directory
if ($app->isSite())
CkJController::addModelPath(JPATH_SITE_CHOLALMS .DS.'models');
else
CkJController::addModelPath(JPATH_ADMIN_CHOLALMS .DS.'models');

// Set the table directory
JTable::addIncludePath(JPATH_ADMIN_CHOLALMS . DS . 'tables');
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

CKJModel get instance not working from the plugin 10 Sep 2014 12:56 #12618

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
It seems to be a random problem from the JLoader.

To be sure the models are loaded correctly, I have place your code in the end of the loader file, so now it can work. In fact it is the right place.

K++
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Last edit: by admin.
  • Page:
  • 1
Time to create page: 0.128 seconds

This is what you call a component builder. I was able to master using this in a very short time and the resulting component works like a charm. Not just a basic component builder but a fully working component builder with forms fields tables all ready to go. You can make the list and item views to display in the front and back end. Also there is a great forum just starting to evolve and I'm sure this will grow very rapidly when you all realise how good this tool is.
Kevin (JED)

         

Get Started