store article using article model - Joomla! Forum - community, help and support


hi,
i developed on past component on joomla 1.5.
on component article created using

code: select all

   
jmodel::addincludepath(jpath_site.ds.'components'.ds.'com_content'.ds.'models');
class testsmodeltest extends jmodel {
...
   $article = array();
   $article['catid'] = $sec_cat_associated->article_category_id;
   $article['author'] = $this->_data->author;
...
   $model =& jmodel::getinstance('article', 'contentmodel');
   $model->store($article);
...
}


i moved component joomla 2.5 , goes fine except saving (store) article.
i obtain following message:
call undefined method contentmodelarticle::save()
because on joomla 2.5 method doesn't exist anymore on model. tried save adding includepath of administration, , neither work !

anyone know how ?
thanks in advance,
albert

finally solved using jtable:

$article = array();
$article['catid'] = '2';
$article['created_by'] = '42';
$article['title'] = 'ksjksd';
$article['introtext'] = 'ksjksd';
$article['fulltext'] = 'ksjksd';

$table = jtable::getinstance('content', 'jtable', array());

// bind data
if (!$table->bind($article))
{
$this->seterror($table->geterror());
return false;
}

// check data.
if (!$table->check())
{
$this->seterror($article->geterror());
return false;
}

// store data.
if (!$table->store())
{
$this->seterror($article->geterror());
return false;
}





Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support