O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

5. hello popescu

51 visualizações

Publicada em

http://www.rraducanu.ro

Publicada em: Educação
  • Login to see the comments

  • Seja a primeira pessoa a gostar disto

5. hello popescu

  1. 1. Hello Popescu
  2. 2. FormController <?php namespace FormeController; use ZendMvcControllerAbstractActionController; use ZendViewModelViewModel; class FormController extends AbstractActionController { public function indexAction() { return new ViewModel(); }
  3. 3. public function helloAction() { $form=new FormeFormMyForm(); if(!isset($_POST["nume"])){ $msg="Hello! Please enter your name: <br/>"; }else{ $msg="Welcome <b>".$_POST["nume"]."</b>!<br/>"; } $viewModel = new ViewModel(array('msg' => $msg,'form'=>$form)); $viewModel->setTemplate('forme/index/hello'); return $viewModel; } }
  4. 4. view/forme/index/hello.phtml <?php $form=$this->form; $form->prepare(); echo $this->form()->openTag($form); echo $msg; echo $this->formRow($form->get('nume')); echo " "; echo $this->formSubmit($form->get('submit')); echo '<br/>'; echo $this->form()->closeTag();
  5. 5. module/Forme/config/module.config.php …………… 'hello' => [ 'type' => Literal::class, 'options' => [ 'route' => '/hello', 'defaults' => [ 'controller' => ControllerFormController::class, 'action' => 'hello', ], ], ], ……………………………………..
  6. 6. ………………. 'controllers' => [ 'factories' => [ ControllerIndexController::class => InvokableFactory::class, ControllerFormController::class=>InvokableFactory::class, ], ………………………….
  7. 7. ……………………….. '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', 'error/404' => __DIR__ . '/../view/error/404.phtml', 'error/index' => __DIR__ . '/../view/error/index.phtml', ], ………………………

×