本文整理汇总了PHP中cmsTemplate::hasOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsTemplate::hasOptions方法的具体用法?PHP cmsTemplate::hasOptions怎么用?PHP cmsTemplate::hasOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsTemplate
的用法示例。
在下文中一共展示了cmsTemplate::hasOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($template_name)
{
$template = new cmsTemplate($template_name);
if (!$template->hasOptions()) {
cmsCore::error404();
}
$form = $template->getOptionsForm();
$options = $template->getOptions();
if ($this->request->has('submit')) {
// Парсим форму и получаем поля записи
$options = $form->parse($this->request, true, $options);
// Проверям правильность заполнения
$errors = $form->validate($this, $options);
if (!$errors) {
if ($template->saveOptions($options)) {
cmsUser::addSessionMessage(LANG_CP_SAVE_SUCCESS, 'success');
} else {
cmsUser::addSessionMessage(LANG_CP_SETTINGS_TPL_NOT_WRITABLE, 'error');
}
$this->redirectToAction('settings');
}
if ($errors) {
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
}
}
return $this->cms_template->render('settings_theme', array('template_name' => $template_name, 'options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
}
示例2: run
public function run($template_name)
{
$template = new cmsTemplate($template_name);
if (!$template->hasOptions()) {
cmsCore::error404();
}
$form = $template->getOptionsForm();
// Форма отправлена?
$is_submitted = $this->request->has('submit');
$options = $template->getOptions();
if ($is_submitted) {
// Парсим форму и получаем поля записи
$options = $form->parse($this->request, $is_submitted, $options);
// Проверям правильность заполнения
$errors = $form->validate($this, $options);
if (!$errors) {
$template->saveOptions($options);
$this->redirectBack('settings');
}
if ($errors) {
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
}
}
return cmsTemplate::getInstance()->render('settings_theme', array('template_name' => $template_name, 'options' => $options, 'form' => $form, 'errors' => isset($errors) ? $errors : false));
}