Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

6. hello popescu 2

69 views

Published on

http://www.rraducanu.ro

Published in: Education
  • Be the first to comment

  • Be the first to like this

6. hello popescu 2

  1. 1. Hello Popescu 2
  2. 2. FormController ……………………. public function popescuAction() { $form=new FormeFormMyForm(); $viewModel = new ViewModel(array('form'=>$form)); $viewModel->setTemplate('forme/index/popescu_form'); return $viewModel; }
  3. 3. public function showpopescuAction() { if(empty($_POST["nume"])){ $msg="Hello! Please return and enter your name: <br/>"; }else{ $msg="Welcome <b>".$_POST["nume"]."</b>!<br/>"; } $viewModel = new ViewModel(array('msg' => $msg)); $viewModel->setTemplate('forme/index/popescu_show'); return $viewModel; }
  4. 4. view/forme/index/popescu_form.phtml <?php $form=$this->form; $form->prepare(); echo $this->form()->openTag($form); echo $this->formRow($form->get('nume')); echo " "; echo $this->formSubmit($form->get('submit')); echo '<br/>'; echo $this->form()->closeTag();
  5. 5. view/forme/index/popescu_show.phtml <?php echo $msg; ?>
  6. 6. module/Forme/config/module.config.php …………… 'popescu' => [ 'type' => Literal::class, 'options' => [ 'route' => '/popescu', 'defaults' => [ 'controller' => ControllerFormController::class, 'action' => 'popescu', ], ], ], ……………………………………..
  7. 7. 'showpopescu' => [ 'type' => Literal::class, 'options' => [ 'route' => '/showpopescu', 'defaults' => [ 'controller' => ControllerFormController::class, 'action' => 'showpopescu', ], ], ], …………………………………
  8. 8. ………………. 'controllers' => [ 'factories' => [ ControllerIndexController::class => InvokableFactory::class, ControllerFormController::class=>InvokableFactory::class, ], ………………………….
  9. 9. ……………………….. 'view_manager' => [ 'display_not_found_reason' => true, 'display_exceptions' => true, 'doctype' => 'HTML5', 'not_found_template' => 'error/404', 'exception_template' => 'error/index', 'template_map' => [ 'layout/layout' => __DIR__ . '/../view/layout/layout.phtml', 'forme/index/index' => __DIR__ . '/../view/forme/index/index.phtml', 'forme/index/hello' => __DIR__ . '/../view/forme/index/hello.phtml', 'forme/index/popescu' => __DIR__ . '/../view/forme/index/popescu_form.phtml', 'forme/index/showpopescu' => __DIR__ . '/../view/forme/index/popescu_show.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', 'error/index' => __DIR__ . '/../view/error/index.phtml', ],………………………
  10. 10. /src/Form/MyForm.php ……………. public function __construct() { parent::__construct('myform');//my_form este numele formei $this->setAttribute('method', 'post'); $this->setAttribute('action', '/showpopescu'); //text $this->add([ 'type'=>'text', ………………………………….

×