1
Joomla! 3 / RISOLTO: Creare articoli Joomla con Chronoforms V5
« il: 25 Giu 2018, 10:39:50 »
Ciao a tutti,
finalmente ho trovato una soluzione alternativa:
ho usato le API di Joomla al posto della funzione di CF5 e funziona correttamente!
Ecco il codice usato:
finalmente ho trovato una soluzione alternativa:

Ecco il codice usato:
Codice: [Seleziona]
<?php
if (version_compare(JVERSION, '3.0', 'lt')) {
JTable::addIncludePath(JPATH_PLATFORM . 'joomla/database/table');
}
$article = JTable::getInstance('content');
$article->title = $form->data['my_title'];
$article->alias = JFilterOutput::stringURLSafe($form->data['my_title']);
$article->introtext = $form->data['my_introtext'];
$article->fulltext = $form->data['my_fulltext'];
$article->catid = my_cat_ID;
$article->created = JFactory::getDate()->toSQL();;
$article->created_by_alias = JFactory::getUser()->get('name');;
$article->state = 0; //0=disabled 1=enabled
$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());
return FALSE;
}
// Now store the article, raise notice if it doesn't get stored.
if (!$article->store(TRUE)) {
JError::raiseNotice(500, $article->getError());
return FALSE;
}
?>