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 :-

<?php

/**
* @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; ?>

	</div>

	

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

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

	<?php endif; ?>

	

</fieldset>



<?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')); ?>

	

</fieldset>

<?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')); ?>

	

</fieldset>

<?php endif; ?>
Member Avatar for 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.

Member Avatar for diafol

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.