Best Answer SmetDenis , 05 March 2014 - 11:01
а как именно внести новый элемент в базу
Создаете пустой объект материала, наполняете его, сохраняете.
// пустышка
$item = $this->app->object->create('Item');
// наполняем стандартные поля
$item->application_id = 10;
$item->name = 'Item name';
$item->alias = 'item-alias';
$item->type = 'type-alias';
$item->publish_up = $this->app->date->create()->toSQL();
$item->publish_down = $this->app->database->getNullDate();
$item->created = $this->app->date->create()->toSQL();
$item->created_by = JFactory::getUser()->get('id');
$item->created_by_alias = '';
$item->state = 1;
$item->searchable = 1;
// наполняем пользовательские поля
$item->getElement('<element_id>')->bindData(array(
'value' => '123' // данные в формате элемента, можно посмотреть PMA
));
// сохраняем
$this->app->table->item->save($item);
Go to the full post


This topic is locked









