Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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');
- $json_str = array('title 1', 'title 2', 'title 3');
- $new_article = new ContentModelArticle();
- foreach($json_str as $row){
- var_dump($row);
- $data = array(
- 'title' => $row,
- 'alias' => time(),
- 'introtext' => 'my intro text',
- 'catid' => 8,
- 'created_by' => 434,
- 'access' => 1,
- );
- $new_article->save($data);
- }
Advertisement
Add Comment
Please, Sign In to add comment