I had setup some submission form using Joomla and a CCK component "Zoo", when i click for the form, i get this error :

Fatal error: Call to a member function getItem() on a non-object in /home/content/b/o/o/boomshiva/html/tafconnect/bazaar/media/zoo/applications/business/templates/default/renderer/item/submission.php on line 15

Can anyone help me with that

The contents of the mentioned PHP file is this :-


* @package   com_zoo
* @author    YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only

// no direct access

defined('_JEXEC') or die('Restricted access');


<fieldset class="pos-content creation-form">

	<legend><?php echo $form->getItem()->getType()->name; ?></legend>


	<div class="element element-name required <?php echo ($form->hasError('name') ? 'error' : ''); ?>">

		<strong><?php echo JText::_('Name'); ?></strong>

		<input type="text" name="name" size="60" value="<?php echo $form->getTaintedValue('name'); ?>" />

		<?php if ($form->hasError('name')) : ?>

			<div class="error-message"><?php echo $form->getError('name'); ?></div>

		<?php endif; ?>



	<?php if ($this->checkPosition('content')) : ?>

	<?php echo $this->renderPosition('content', array('style' => 'submission.block')); ?>

	<?php endif; ?>



<?php if ($this->checkPosition('media')) : ?>

<fieldset class="pos-media creation-form">

	<legend><?php echo JText::_('Media'); ?></legend>


	<?php echo $this->renderPosition('media', array('style' => 'submission.block')); ?>



<?php endif; ?>

<?php if ($this->checkPosition('meta')) : ?>

<fieldset class="pos-meta creation-form">

	<legend><?php echo JText::_('Meta'); ?></legend>


	<?php echo $this->renderPosition('meta', array('style' => 'submission.block')); ?>



<?php endif; ?>
5 Years
Discussion Span
Last Post by diafol
echo $form->getItem()->getType()->name;

Where is $form instanced?

You should have $form = new zooForm(); [or something like that!] somewhere

echo $form->getItem()->getType()->name;

Where is $form instanced?

You should have $form = new zooForm(); [or something like that!] somewhere

No idea, what you are talking about.


You are using a class which is called something like zooForm or something similar (I don't know as I don't use this class).

If you want to make use of the class, as a rule you need to create an object. In your case, the object is called $form. SO, you should have a line something like I've posted above.

If not, then your code won't work as the methods (class functions) inside the class cannot be accessed through an object.

If you don't understand OOP - have a look at some tutorials. You'll need it to debug CMSes that implement classes and more specifically, third-party classes.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.