To create an article programatically in Joomla... if (version_compare(JVERSION, '3.0', 'lt')) { JTable::addIncludePath(JPATH_PLATFORM . 'joomla/database/table'); } $article = JTable::getInstance('content'); $article->title = 'This is my super cool title!'; $article->alias = JFilterOutput::stringURLSafe('This is my super cool title!'); $article->introtext = '

This is my super cool article!

'; $article->catid = 9; $article->created = JFactory::getDate()->toSQL(); $article->created_by_alias = 'Super User'; $article->state = 1; $article->access = 1; $article->metadata = '{"page_title":"","author":"","robots":""}'; $article->language = '*'; // Check to make sure our data is valid, raise notice if it's not. if (!$article->check()) { JError::raiseNotice(500, $article->getError()); } // Now store the article, raise notice if it doesn't get stored. if (!$article->store(TRUE)) { JError::raiseNotice(500, $article->getError()); }
To Create OR Update based on an alias... $ipf=JFilterOutput::stringURLSafe($ip); // this is the alias $article = JTable::getInstance('content'); $article->load(array('alias'=>$ipf)); $id=$article->id;   if ($id==null) { $article->title = 'Blacklist for IP '.$ip; $article->alias = $ipf; $article->catid = 13; $article->introtext = $html;  $article->created = JFactory::getDate()->toSQL(); $article->created_by_alias = 'Super User'; $article->state = 1; $article->access = 1; $article->metadata = '{"page_title":"","author":"","robots":""}'; $article->language = '*'; if (!$article->check()) { echo "CREATE CHECK FAILED ".$article->getError();  }  if (!$article->store(TRUE)) { echo "CREATE STORE FAILED ".$article->getError();  }  } else { $article->introtext = $html; if (!$article->check()) { echo "UPDATE CHECK FAILED ".$article->getError();  } if (!$article->store()) { echo "UPDATE STORE FAILED ".$article->getError();  }  } --- //[[richard@gen.net.uk|Richard]] 2019/03/21 11:16//