Load jInput failed

47 views
Skip to first unread message

Viktor Iwan

unread,
Feb 26, 2013, 3:58:58 AM2/26/13
to joomla-de...@googlegroups.com
Hello,
i'm trying to load jInput Object in My Platform apps, but failed, i already add:

require  JPATH_BASE.'/libraries/joomla/application/input.php';
$jinput = JFactory::getApplication()->input;
$foo = $jinput->get('test', 'yes', 'string');

it returns error "Fatal error: Call to a member function get() on a non-object in..."

any idea ? i don't have problem with jRequest... but i think i need to get used with jInput....

Ian

unread,
Feb 26, 2013, 8:47:49 AM2/26/13
to joomla-de...@googlegroups.com
JFactory::getApplication isn't returning an object because it probably hasn't been set yet.  You need to prime the factory now.  It is far better to manage your application on its own than to use the factory anyway.

Nonetheless, if JFactory makes you feel more comfortable, then you can still use it.  You'll see it being populated at at: https://github.com/joomla/joomla-platform-examples/blob/master/web/flickr-feed/index.php#L105

Ian

On Tuesday, 26 February 2013 04:12:18 UTC-5, Dmitry Rekun wrote:
Hi!

You do not need to require input separately. The instance of Input should be in Application already. Does your Application extends JApplicationWeb?

Dmitry.
Reply all
Reply to author
Forward
0 new messages