I'm coding at present the admin interface of a demo component. In the view works so far... but the model (database table) is using another table too... so I thought I write another model to store the data of the second table. Storing the data works without any problems... but now getting them in the view.
Here's the structure:
Code: Select all
 *advertisement
 ** advertisement images - holding a foreign key to advertisement
Well... I'm just getting a null pointer when I try to fetch the advertisement image model:
Code: Select all
<?php
   function display($tpl = null)
   {
      //taking the advertisement
       $rl_ad        =& $this->get('Data');
       $isNew        = ($rl_ad->id < 1);
      
      // and now the images via the adiamage model...
      $adimage_model = $this->getModel('adimage'); // here I'm getting the null pointer !
      $rl_ad_images =& $adimage_model->getAllOfAdvertisement($rl_ad->id);
       $text = $isNew ? JText::_( 'New' ) : JText::_( 'Edit' );
       JToolBarHelper::title(   JText::_( 'Advertisement' ).': <small><small>[ ' . $text.' ]</small></small>' );
       JToolBarHelper::save();
       if ($isNew)  {
           JToolBarHelper::cancel();
       } else {
           // for existing items the button is renamed `close`
           JToolBarHelper::cancel( 'cancel', 'Close' );
       }
      
      $body_editor =& JFactory::getEditor();
      
      $this->assignRef( 'body_editor', $body_editor );
       $this->assignRef('rl_ad', $rl_ad);
       $this->assignRef('rl_ad_images', $rl_ad_images);
       parent::display($tpl);
   }
?>
I hope, someone can help me out....
Bye, Alex


