I have this code from http://forum.joomla.org/viewtopic.php?f=615&t=727313 to insert my scraped data from a crawl bot written in python:
<?php
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(dirname(__FILE__)));
define( 'DS', DIRECTORY_SEPARATOR );require_once (JPATH_BASE . DS . 'includes' . DS . 'defines.php');
require_once (JPATH_BASE . DS . 'includes' . DS . 'framework.php');
require_once (JPATH_BASE . DS . 'libraries' . DS . 'joomla' . DS . 'factory.php' );
define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_BASE . DS . 'administrator' . DS . 'components' . DS . 'com_content');
$mainframe = JFactory::getApplication('site');require_once (JPATH_ADMINISTRATOR.'/components/com_content/models/article.php');
$new_article = new ContentModelArticle();
$data = array(
'catid' => 8,
'title' => 'SOME TITLE',
'introtext' => 'SOME TEXT',
'fulltext' => 'SOME TEXT',
'state' => 1,
'metadata' => '{"robots":"","author":"","rights":"","xreference":"","tags":null}',
);
$new_article->save($data);It works well except I am getting plugin (specifically tortags, but could be other, too) error like this:
PHP Warning: Parameter 2 to plgContentTorTags::onContentAfterSave() expected to be a reference, value given in /var/www/www.example.com/htdocs/libraries/joomla/event/event.php on line 71
PHP Stack trace:
PHP 1. {main}() /var/www/www.example.com/htdocs/administrator/a_instance.php:0
PHP 2. ContentModelArticle->save() /var/www/www.example.com/htdocs/administrator/a_instance.php:27
PHP 3. JModelAdmin->save() /var/www/www.example.com/htdocs/administrator/components/com_content/models/article.php:456
PHP 4. JEventDispatcher->trigger() /var/www/www.example.com/htdocs/libraries/legacy/model/admin.php:1081
PHP 5. JEvent->update() /var/www/www.example.com/htdocs/libraries/joomla/event/dispatcher.php:161
PHP 6. call_user_func_array() /var/www/www.example.com/htdocs/libraries/joomla/event/event.php:71I am new to Joomla development, what I am suspecting is that my $data that is to feed to $new_article is not well formed, I have no knowledge to check as what could or should I include in $data array and in what form? Can someone educate me on that?
Thanks,
> email to joomla-dev-general+unsub...@googlegroups.com.