comment créer un nouveau document à partir d'extrait dans modx évolution 1.0.4

StackOverflow https://stackoverflow.com/questions/4237847

  •  26-09-2019
  •  | 
  •  

Question

i trouvé par exemple pour une version plus ancienne, mais ma version actuelle n'a pas d'actifs / libs / DocManager / document.class.inc.php fichier et dossier libs dosn't existe aussi. AIDE GARS!

function CreateNewArticle(&$fields){
// Массив $fields будет содержать данные всех полей формы
// Создания документа с описанием.
require_once('assets/libs/docmanager/document.class.inc.php');
$doc = new Document(); // создаем документ
$doc->Set('parent',9); // определяем в какую папку положить
$doc->Set('template','psih'); // задаем шаблон
$doc->Set('content',$fields['content']); // основное содержимое
// Далее пойдут TV-параметры
$doc->Set('tvAvtor',$fields['avtor']); // автор
$doc->Set('tvEmail',$fields['email']); // e-mail
$doc->Save(); // сохраняем
return true; // Говорим eForm, что все в порядке.

}

Était-ce utile?

La solution

Autres conseils

Installer CakeMOdx . Il est une classe d'API pour MODx Evolution. Il prévoit, entre autres, une fonction "NewDocument".

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top