[!digiFaq? &callFunction=`1` &callOutput=`0`!] [!eForm? &lang=`russian` &formid=`faqForm` &tpl=`шаблон формы` &noemail=`1` &allowhtml=`0` &sendAsHtml=`0` &eFormOnBeforeMailSent=`addQuestion` &vericode=`1` !] [!digiFaq? &callFunction=`0` &callOutput=`1`!]
[!digiFaq? &callOutput=`0`!] [!eForm? &lang=`russian` &formid=`faqForm` &tpl=`шаблон формы` &noemail=`1` &allowhtml=`0` &sendAsHtml=`0` &eFormOnBeforeMailSent=`addQuestion` &vericode=`1` !] [!digiFaq? &callFunction=`0`!]

[!digiFaq!] [!eForm? &lang=`russian` &formid=`faqForm` &tpl=`chunk_faqTpl` &noemail=`1` &allowhtml=`0` &sendAsHtml=`0` &eFormOnBeforeMailSent=`addQuestion` &vericode=`0`!]
<?php
$faqTpl = isset($faqTpl) ? $faqTpl : 'faqDisplayTpl';
$callFunction = isset($callFunction) ? $callFunction : '1';
$callOutput = isset($callOutput) ? $callOutput : '1';
$dateFormat = isset($dateFormat) ? $dateFormat : 'j.m.Y G:i:s';
$notAnswered = isset($notAnswered) ? $notAnswered : 0;
if ($callOutput == 1) {
$notAnswered == 1 ? $notAnsweredSql = '' : $notAnsweredSql = "answer != ''";
$modx->regClientCss("assets/modules/digiFaq/style.css");
$result = $modx->db->select("*","faq",$notAnsweredSql,"id DESC");
$questions = $modx->db->makeArray($result);
foreach($questions as $p_array) {
$faqTemplate = $modx->getChunk($faqTpl);
$chunkArr = array(
'fq.name' => $p_array['name'],
'fq.email' => $p_array['email'],
'fq.question' => $p_array['question'],
'fq.answer' => $p_array['answer'],
'fq.phone' => $p_array['phone'],
'fq.date' => date($dateFormat, $p_array['date']),
);
$output .= $modx->parseChunk($faqTpl,$chunkArr, '[+','+]');
}
return $output;
}
if ($callFunction == 1) {
/* Eform function, to add questions to Database. REQUIRED */
function addQuestion() {
global $modx;
$question = $_POST['question'];
$name = $modx->db->escape($_POST['name']);
$email = $modx->db->escape($_POST['email']);
$phone = $modx->db->escape($_POST['phone']);
$date = time();
$data = array();
$data['name'] = $name;
$data['email'] = $email;
$data['date'] = $date;
$data['phone'] = $phone;
$data['question'] = $question;
$fields = array('name' => $data['name'],
'email' => $data['email'],
'date' => $data['date'],
'phone' => $data['phone'],
'question' => $data['question'],
);
$modx->db->insert($fields, 'faq');
return true;
}
}
?>
?
$textfield = isset($_POST['textfield']) ? $_POST['textfield'] : "";
if(!empty($textfield)) echo "Your text was: $textfield";
echo "<form action='".$_SERVER["REQUEST_URI"]."' method=POST>";
echo "<div><textarea id='textfield' name='textfield' style='width:100%;' onchange='documentDirty=true;'>$textfield</textarea></div>";
echo "<button type='submit'>Send</button>";
echo "</form>";
$event_output = $modx->invokeEvent("OnRichTextEditorRegister");
if(is_array($event_output)) $editor = $event_output[0];
else return "";
$event_output = $modx->invokeEvent("OnRichTextEditorInit", array('editor'=>$editor, 'elements'=>array("textfield")));
if(is_array($event_output)) $editor_html = implode("",$event_output);
echo $editor_html;
В сниппете есть эта функция, т.к. код вставлялся из файла который лежит в архиве.
на всякий случай приведу:
...
Пробовал переустановить модуль. Ничего не изменилось. Все та же ошибка. Может в моем порядке действий что-то не то?
"Управление модулями" - "Новый модуль" - название "FAQ" - вставляю код из module_digiFaq.txt - "Сохранить" - обновляю - "Модули" - "FAQ". название и заголовки таблицы на месте. "Модули" - "Редактирование модуля FAQ" - "зависимости" - добавляю сниппет eForm, сохраняю.
Сниппет стандартно ставился, Плагин тоже. Событие отмечено, конфигурация пуста.
Где копать ? =)
[!digiFaq? &callFunction=`1` &callOutput=`0`!] [!digiFaq? &callOutput=`1`!] [!eForm? &lang=`russian` &formid=`faqForm` &tpl=`chunk_faqTpl` &to=`[email protected]` &from=`[email protected]` &fromname=`Сайтовой` &subject=`Вам письмо` &report=`faqReport` &allowhtml=`0` &sendAsHtml=`0` &eFormOnBeforeMailSent=`addQuestion` &vericode=`0` !]
&vericode=`0`