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

TOPIC:

[FIXED] Error on JFactory::getApplication()->input; 20 Nov 2012 09:22 #5491

  • smarano
  • smarano's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 1
Hello, I created my component with version 2.0, which should be compatible with the 1.6 version of joomla and not function. By debugging joomla gives me these errors:
Notice: Undefined property: JAdministrator :: $ input in / var / www / vhosts / ***** / httpdocs / administrator / components / com_oevent / controller.php on line 55

"Fatal error: Call to a member function get () on a non-object in / var / www / vhosts / ***** / httpdocs / administrator / components / com_oevent / controller.php on line 57

Apparently it is on the following lines controller.php:
$ jinput = JFactory :: getApplication () -> input;

self :: addSubmenu ($ jinput-> get ('view', 'events', 'STRING'), $ jinput-> get ('layout', null, 'STRING'));

Seems that in joomla 1.6 not exists the library Jinput and not exists the method input of Japplication

J-cook version 2.0 is really compatible with joomla 1.6 ????

Can anyone help me? thanks

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

Last edit: by smarano.

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 09:51 #5492

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Hi there,

If you look further down in that controller, probably around line 72, you should see the function:
protected function addSubMenu($view = null, $layout = null)
.

Inside it, do you see a JSubMenuHelper::addEntry for your events view and layout? Have you changed the layout name or something maybe?

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

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

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 10:00 #5493

  • smarano
  • smarano's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 1
here is my file controller.php:
<?php
/**                               ______________________________________________
*                          o O   |                                              |
*                 (((((  o      <    Generated with Cook Self Service  V2.0     |
*                ( o o )         |______________________________________________|
* --------oOOO-----(_)-----OOOo---------------------------------- www.j-cook.pro --- +
* @version		1.0.0
* @package		oEvent
* @subpackage	
* @copyright	Copyright 2012, All rights reserved
* @author		Gabriele Marano - www.omarano.com - gabriele.marano@gmail.com
* @license		GNU/GPL
*
* /!\  Joomla! is free software.
* This version may have been modified pursuant to the GNU General Public License,
* and as distributed it includes or is derivative of works licensed under the
* GNU General Public License or other free or open source software licenses.
*
*             .oooO  Oooo.     See COPYRIGHT.php for copyright notices and details.
*             (   )  (   )
* -------------\ (----) /----------------------------------------------------------- +
*               \_)  (_/
*/

// no direct access
defined('_JEXEC') or die;

jimport('joomla.application.component.controller');

/**
 * Component Controller
 *
 * @package		Joomla.Administrator
 * @subpackage	com_content
 */
class OeventController extends JController
{
	/**
	 * @var		string	The default view.
	 * @since	1.6
	 */
	protected $default_view = 'eventi';

	/**
	 * Method to display a view.
	 *
	 * @param	boolean			If true, the view output will be cached
	 * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
	 *
	 * @return	JController		This object to support chaining.
	 * @since	1.5
	 */
	public function display($cachable = false, $urlparams = false)
	{
		$jinput = JFactory::getApplication()->input;

		self::addSubMenu(	$jinput->get('view', 'eventi', 'STRING'),
							$jinput->get('layout', null, 'STRING'));

		parent::display();

		//If page is called through POST only, reconstruct the url
		if (!isset($_GET['option']))
		{
			//Kill the post and rebuild the url
			$this->setRedirect(OeventHelper::urlRequest());
			return;
		}

		return $this;
	}

	protected function addSubMenu($view = null, $layout = null)
	{
		JSubMenuHelper::addEntry(JText::_("OEVENT_VIEW_EVENTI"), 'index.php?option=com_oevent&view=eventi', ($view == 'eventi'));
		JSubMenuHelper::addEntry(JText::_("OEVENT_VIEW_REGIONI"), 'index.php?option=com_oevent&view=regioni', ($view == 'regioni'));
		JSubMenuHelper::addEntry(JText::_("OEVENT_VIEW_PROVINCE"), 'index.php?option=com_oevent&view=province', ($view == 'province'));
		JSubMenuHelper::addEntry(JText::_("OEVENT_VIEW_COMUNI"), 'index.php?option=com_oevent&view=comuni', ($view == 'comuni'));
		JSubMenuHelper::addEntry(JText::_("OEVENT_VIEW_CAPS"), 'index.php?option=com_oevent&view=caps', ($view == 'caps'));

	}


}

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

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 10:14 #5494

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
And does the eventi layout/and view actually exist? Have you renamed it?
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

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

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 10:32 #5495

  • smarano
  • smarano's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 1
yes, if you install it on joomla 2.5 works correctly..

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

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 10:45 #5496

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Ah, OK...

In that case I'm afraid I'll have to post this to admin. I've no experience with J!1.6/1.7 (only 1.5 and 2.5) to be able to advise you of how to proceed to account for changes in the core.

have you checked out the relevant functions/classes in 1.6 docs to compare?

Anyway, as I said, will get this over to admin!

Best of luck

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

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

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 11:57 #5497

  • smarano
  • smarano's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 1
I found this link: docs.joomla.org/Retrieving_request_data_using_JInput

if you read the last lines we understand that it was probably included from the 1.7.1 release of Joomla!


"We'll be adding input as a public property to JApplication in the near future. It might be an idea if the CMS folks so chose to release a 1.7.1 that included this so developers can use it now. Otherwise, at this point in time, it is best to still use JRequest."

@admin is possible to fix this problem?

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

Last edit: by smarano.

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 13:13 #5498

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
The only way around that I see would be to:

Copy the input into your application library of your 1.6 joomla installation manually OR inside your controller, throw a switch or if condition based on the joomla version... This should work for both versions then/ To clarify, use JRequest if [RELEASE] element of JVersion object is <= 1.7 && [DEV_LEVEL]!= 1 (or greater) ELSE, use JInput

Try this to get you started:
/* ----------------------------------------------------------
CHECK THE JOOMLA VERSION THEN DO SOMETHING
---------------------------------------------------------- */
jimport('joomla.version');
$version = new JVersion();
if (!$version) {
	echo "No JVersion";
} else {
	// Print the object to see all elements of obj
	echo "<pre>"; print_r($version); echo "</pre>";

	// Now, here is where you'll need to switch cases or use IF/ELSE Eval
}

/* -------------------- END ------------------------------ */
Hope it helps!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

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

Last edit: by JoomGuy. Reason: Added notes on switch, if and else

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 13:15 #5499

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
To notify of slight edit previous + link: forum.joomla.org/viewtopic.php?t=172976
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

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

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 14:24 #5501

  • smarano
  • smarano's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 1
@audibleid, it is a good solution, but I think the code should be rewritten using JRequest because it is compatible with all versions of joomla. Jinput does not allow any component generated with version 2.0 of the j-cook to be compatible with all versions of joomla. I wait for @admin read this thread and try to solve this problem.

Thank you so much you were very kind to help me + 1 carma

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

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 14:42 #5506

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
No probs!

I've posted it to admin and suggested that if he thinks it is a good solution then he could include it in a static helper function to include in COOK components. I know he's massively busy at the moment with last few tweaks to move 2.0b into fully-production-ready so I wouldn't anticipate this being a quick thing.

Is JRequest compatible with Joomla 3? I may be wrong but, I don't believe it is... However, even if it is, it seems as if it is making it's way out so it may be well worth looking to the future rather than backwards as both 1.6 & 1.7 are short life spans of only 6 months.

Anyway, totally up to you! Thanks again and hope you find a solution that suits your needs!!

Take care,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

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

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 14:57 #5508

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
@smarano,

Have you read the background section of the joomla doc you linked to earlier... There are a lot of advantages to using JInput over JRequest. In short, it's a lot more flexible, not static like JRequest and can even filter arrays... Much more MVC friendly as the values passed can come from or be used anywhere.

docs.joomla.org/Retrieving_request_data_using_JInput#Background

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

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

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 15:18 #5509

  • smarano
  • smarano's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 1
@audibleid, you're right, maybe in later versions of joomla to 1.6 JRequest is deprecated. I have problems to update joomla and like me there are so many other people and being a paid service and advertised as compatible with 1.6 1.7 and 2.5 I think it should be really, even if you have to wait a little and especially because it is a problem "fatal" that goes to impact the entire operation of the component.

Anyway thanks again.

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

Last edit: by smarano.

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 16:56 #5513

  • smarano
  • smarano's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 1
I've fixed the problem of Jinput but now tells me that this is not supported: JHTML :: _ ('behavior.multiselect');

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

Re: HELP! Error on JFactory::getApplication()->input; 20 Nov 2012 17:31 #5514

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
I think that this is going to be JForm related... Not sure as I never used 1.6 but, I bet it doesn't use JForms.

Try changing your form style config option to JDom if you're already using the condensed or exploded option.

How did you fix the JInput, with the JVersion Object?

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

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

  • Page:
  • 1
  • 2
Time to create page: 0.088 seconds

  Merci d'avoir présenté ce service web générateur de composant joomla. L'interface est très conviviale on a le plaisir du drag&drop et c'est assez rare pour être signalé. Je souhaite que ce projet connaisse un fort succès votre réalisation est méritante.
Yann Gomiero (AFUJ - France)

Get Started