MODx: sending information from form to new page



  • It is necessary to use the form not to email, but to create a new resource with data from the form. Tell me where to dig?



  • Let's take it that you have revo
    Use the processor resource/create

    $parent = 9999; // id родительского ресурса (куда будем создавать ресурс)
    

    /* Получаем */
    $pagetitle = "Получаем заголовок"; // $_POST['pagetitle'];
    $content = "Получаем контент"; // $_POST['content'];

    /* Создаём новый ресурс */
    $response = $modx->runProcessor('resource/create', array(
    'pagetitle' => $pagetitle,
    'content' => $content,
    'published' => 1,
    'parent' => $parent));
    if ($response->isError()) {
    return $modx->error->failure($response->getMessage());
    }

    $newResource = $response->response['object'];

    /* Очищаем кэш */
    $modx->cacheManager->refresh();
    return;




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2