Joomla! Discussion Forums



It is currently Tue Nov 24, 2009 6:17 am (All times are UTC )

 





Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Model getData not called
Posted: Sun Aug 24, 2008 6:06 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Sat Aug 23, 2008 10:40 pm
Posts: 1
hope anyone sees my minor code error. I'm building a custom mvc component which is in a running state. I built it on top of some helloworld example (http://joomlaequipment.com/content/view/47/74/)
I then was going to add models and tables without luck.

it's like model getData is never called in the view.
Here is my model code ( /administrator/components/com_aefingatoflur/models/deildir.php)
Code:
jimport( 'joomla.application.component.model' );

class AefingatoflurModelDeildir extends JModel
{
   var $_data;

   function _buildQuery()
   {
      $query = ' SELECT * '
         . ' FROM #__deildir '
      ;
      return $query;
   }

   function getData()
   {
      echo 'test'; //doesn't show up
      // Lets load the data if it doesn't already exist
      if (empty( $this->_data ))
      {
         $query = $this->_buildQuery();
         $this->_data = $this->_getList( $query );
      }
      echo 'test'; //doesn't show up
      return $this->_data;

   }


and here is my view code
Code:
jimport( 'joomla.application.component.view');

class AefingatoflurViewDeildir extends JView
{
   function display($tpl = null)
   {
      JToolBarHelper::title(   JText::_( 'Deildir' ), 'generic.png' );
      JToolBarHelper::deleteList();
      JToolBarHelper::editListX();
      JToolBarHelper::addNewX();

      // new start
      // Get data from the model
      $items      = &$this->get('Data');
      $this->assignRef('items', $items);
      // new end

      parent::display($tpl);
   }
}


any thoughts on why getData doesn't get called?
I read somewhere that classnames should match XxxViewYyyy and XxxModelYyyy which I have followed


Top
  E-mail  
 
Posted: Tue Aug 26, 2008 2:23 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Tue Jun 06, 2006 7:46 am
Posts: 110
Location: Seoul
Hey buddy, im learning about models too right now, when I get something, Ill send it your way! - Ive subcribed to this question...

_________________
Paul Preibisch - Educational Technologist
Fire Centaur - English Village - Secondlife
http://slurl.com/secondlife/English%20V ... 20Village&


Top
   
 
Posted: Tue Aug 26, 2008 2:33 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Tue Jun 06, 2006 7:46 am
Posts: 110
Location: Seoul
There's a really good model thread here: viewtopic.php?f=304&t=316802&start=0

Im gonna try it tomorrow

_________________
Paul Preibisch - Educational Technologist
Fire Centaur - English Village - Secondlife
http://slurl.com/secondlife/English%20V ... 20Village&


Top
   
 
Posted: Wed Aug 27, 2008 5:29 pm 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Tue Nov 08, 2005 9:32 am
Posts: 128
Location: Malaysia
Hi,

tested your code and it works...
Make sure that the view is in a file called view.html.php in the folder /administrator/components/com_aefingatoflur/views/deildir

Model seems to be in the right place... Names of classes are correct.

Could you please post the code for your controller.php? Also do a echo 'test' or similar in the view itself to see if the view is called at all.

Thanks


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group