<?php require './common.php'; require OPT_DIR . 'opt.class.php'; require OPF_DIR . 'opf.class.php'; class myRouter implements iopfRouter { public function createURL($vars) { return var_export($vars, true); } } try { require './include.php'; $tpl = new optClass(); $tpl->loadConfig('./config.php'); $tpl->setMasterPage('master.tpl'); $validator = new opfValidator(); $opf = new opfClass($tpl, $validator->defaultParams()); $opf->createI18n('./'); $opf->setRouter(new myRouter()); $tpl->assign('vars', array('somevar' => 'somevalue')); $tpl->parse('test_router_1.tpl'); } catch (opfException $exception) { opfErrorHandler($exception); } catch (optException $exception) { optErrorHandler($exception); }
public function view() { if ($this->invalid()) { $this->tpl->assign('form2_error', 1); } // The displaying command should be located in the last processed form $this->tpl->parse('test_multiple_1_1.tpl'); } } try { require './include.php'; $tpl = new optClass(); $tpl->loadConfig('./config.php'); $tpl->setMasterPage('master.tpl'); $validator = new opfValidator(); $opf = new opfClass($tpl, $validator->defaultParams()); $opf->createI18n('./'); $form1 = new form1($opf, 'form1'); if ($form1->execute()) { $tpl->assign('fill_form1', 1); $tpl->assign('text', $opf->validator->someText); $tpl->parse('test_multiple_1_2.tpl'); } else { $form2 = new form2($opf, 'form2'); if ($form2->execute()) { $tpl->assign('fill_form2', 1); $tpl->assign('text', $opf->validator->someText); $tpl->parse('test_multiple_1_2.tpl'); } } } catch (opfException $exception) {
// end process(); public function view() { if ($this->invalid()) { $this->tpl->assign('error_msg', 1); } $this->tpl->parse('test_ajax_1.tpl'); } } try { require './include.php'; $tpl = new optClass(); $tpl->loadConfig('./config.php'); $tpl->setMasterPage('master.tpl'); $validator = new opfValidator(); $opf = new opfClass($tpl, $validator->defaultParams()); $opf->createI18n('./'); $opf->handleAjax(); $form = new myForm($opf, 'form1'); if ($form->execute()) { if (!$opf->visit->ajax) { $tpl->assign('username', $opf->validator->username); $tpl->assign('email', $opf->validator->email); $tpl->assign('age', $opf->validator->age); $tpl->assign('content', $opf->validator->content); $tpl->parse('report.tpl'); } } } catch (opfException $exception) { opfErrorHandler($exception); } catch (optException $exception) {