SlideShare a Scribd company logo
1 of 7
Copy2
• composer create-project symfony/website-skeleton symfony5
• cd symfony5
• php bin/console make:controller
>CopyController
• composer php/bin server:start
• http://localhost:8000/copy
Vederea base.html.twig
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock
%}</title>
{% block stylesheets %}{% endblock %}
</head>
<body bgcolor="aquamarine">
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>
Vederea form/index.html.twig
{% extends 'base.html.twig' %}
{% block title %}Copy!{% endblock %}
{% block body %}
{{head|raw}}
{{ form_start(form) }}
{{ form_row(form.nume1,{'value': value1 }) }}
{{ form_row(form.submit) }}
{{ form_row(form.nume2,{'value': value }) }}
{{ form_end(form) }}
{% endblock %}
Controller-ul CopyController
<?php
namespace AppController;
use SymfonyComponentRoutingAnnotationRoute;
use SymfonyBundleFrameworkBundleControllerController;
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentHttpFoundationResponse;
use SymfonyComponentForm;
use SymfonyComponentFormExtensionCoreTypeTextType;
use
SymfonyComponentFormExtensionCoreTypeTextareaType;
use
SymfonyComponentFormExtensionCoreTypeSubmitType;
class CopyController extends Controller
{
/**
* @Route("/copy", name="copy")
*/
public function index(Request $request)
{
$data=[];
$form=$this->createFormBuilder()
->add('nume1', TextType::class,
array('attr'=>array('size'=>'30','placeholder'=>'bau bau')))
->add('submit', SubmitType::class)
->add('nume2', TextareaType::class,
array('attr'=>array('size'=>'30','placeholder'=>'bau
bau'),'required' => false))
->getForm();
$form->handleRequest($request);
$data['head']="<h1>Input your name</h1>";
$data['form']=$form->createView();
if($form->isSubmitted()){
// $data['value']=$request->request->all();
$data['value'] = $form->get('nume1')->getData();
$data['value1'] = $form->get('nume2')->getData();;
}else {
$data['value']='';
$data['value1']='';
}
return $this->render('copy/index.html.twig', $data);
}
}

More Related Content

What's hot

Open course(programming languages) 20150318
Open course(programming languages) 20150318Open course(programming languages) 20150318
Open course(programming languages) 20150318JangChulho
 
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الثني)
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الثني) ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الثني)
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الثني) جامعة القدس المفتوحة
 
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الاول)
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الاول) ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الاول)
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الاول) جامعة القدس المفتوحة
 
Joomla! Day UK 2009 .htaccess
Joomla! Day UK 2009 .htaccessJoomla! Day UK 2009 .htaccess
Joomla! Day UK 2009 .htaccessAndy Wallace
 
Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web frameworktaggg
 
Haml in 5 minutes
Haml in 5 minutesHaml in 5 minutes
Haml in 5 minutescameronbot
 
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクトWordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクトHiromichi Koga
 
ملخص تقنية تصميم صفحات الويب - الوحدة الرابعة
ملخص تقنية تصميم صفحات الويب - الوحدة الرابعةملخص تقنية تصميم صفحات الويب - الوحدة الرابعة
ملخص تقنية تصميم صفحات الويب - الوحدة الرابعةجامعة القدس المفتوحة
 
Player fixo
Player fixoPlayer fixo
Player fixoPesinho
 
Functional testing with capybara
Functional testing with capybaraFunctional testing with capybara
Functional testing with capybarakoffeinfrei
 
Appsplash'16 session (3) "Ui components"
Appsplash'16 session (3) "Ui components"Appsplash'16 session (3) "Ui components"
Appsplash'16 session (3) "Ui components"Hany Halim
 
HTML5 - The 2012 of the Web
HTML5 - The 2012 of the WebHTML5 - The 2012 of the Web
HTML5 - The 2012 of the WebRobert Nyman
 
Build a Better Editing Experience with Advanced Custom Fields - #WCTO16
Build a Better Editing Experience with Advanced Custom Fields - #WCTO16Build a Better Editing Experience with Advanced Custom Fields - #WCTO16
Build a Better Editing Experience with Advanced Custom Fields - #WCTO16Jeseph Meyers
 

What's hot (20)

Open course(programming languages) 20150318
Open course(programming languages) 20150318Open course(programming languages) 20150318
Open course(programming languages) 20150318
 
Mojolicious on Steroids
Mojolicious on SteroidsMojolicious on Steroids
Mojolicious on Steroids
 
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الثني)
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الثني) ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الثني)
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الثني)
 
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الاول)
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الاول) ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الاول)
ملخص تقنية تصميم صفحات الويب - الوحدة الثالثة (الجزء الاول)
 
Intro to jquery
Intro to jqueryIntro to jquery
Intro to jquery
 
Joomla! Day UK 2009 .htaccess
Joomla! Day UK 2009 .htaccessJoomla! Day UK 2009 .htaccess
Joomla! Day UK 2009 .htaccess
 
Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web framework
 
Haml in 5 minutes
Haml in 5 minutesHaml in 5 minutes
Haml in 5 minutes
 
Hmmmm
HmmmmHmmmm
Hmmmm
 
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクトWordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
 
SlideShare Instant
SlideShare InstantSlideShare Instant
SlideShare Instant
 
SlideShare Instant
SlideShare InstantSlideShare Instant
SlideShare Instant
 
ملخص تقنية تصميم صفحات الويب - الوحدة الرابعة
ملخص تقنية تصميم صفحات الويب - الوحدة الرابعةملخص تقنية تصميم صفحات الويب - الوحدة الرابعة
ملخص تقنية تصميم صفحات الويب - الوحدة الرابعة
 
Player fixo
Player fixoPlayer fixo
Player fixo
 
Functional testing with capybara
Functional testing with capybaraFunctional testing with capybara
Functional testing with capybara
 
Appsplash'16 session (3) "Ui components"
Appsplash'16 session (3) "Ui components"Appsplash'16 session (3) "Ui components"
Appsplash'16 session (3) "Ui components"
 
HTML5 - The 2012 of the Web
HTML5 - The 2012 of the WebHTML5 - The 2012 of the Web
HTML5 - The 2012 of the Web
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
Build a Better Editing Experience with Advanced Custom Fields - #WCTO16
Build a Better Editing Experience with Advanced Custom Fields - #WCTO16Build a Better Editing Experience with Advanced Custom Fields - #WCTO16
Build a Better Editing Experience with Advanced Custom Fields - #WCTO16
 
wp cli
wp cliwp cli
wp cli
 

Similar to 7. copy2 in Symfony 4

Simple Markdown with Ecto and Protocols
Simple Markdown with Ecto and ProtocolsSimple Markdown with Ecto and Protocols
Simple Markdown with Ecto and ProtocolsDavid Lucia
 
DRYing Up Rails Views and Controllers
DRYing Up Rails Views and ControllersDRYing Up Rails Views and Controllers
DRYing Up Rails Views and ControllersJames Gray
 
JavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptxJavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptxVivekBaghel30
 
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Hugo Hamon
 
Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Maurizio Pelizzone
 
Flask intro - ROSEdu web workshops
Flask intro - ROSEdu web workshopsFlask intro - ROSEdu web workshops
Flask intro - ROSEdu web workshopsAlex Eftimie
 
What you need to know bout html5
What you need to know bout html5What you need to know bout html5
What you need to know bout html5Kevin DeRudder
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic templatevathur
 
1 Introduction to PHP Overview This lab walks y.docx
1  Introduction to PHP Overview This lab walks y.docx1  Introduction to PHP Overview This lab walks y.docx
1 Introduction to PHP Overview This lab walks y.docxhoney725342
 
Rails Antipatterns | Open Session with Chad Pytel
Rails Antipatterns | Open Session with Chad Pytel Rails Antipatterns | Open Session with Chad Pytel
Rails Antipatterns | Open Session with Chad Pytel Engine Yard
 
Js placement
Js placementJs placement
Js placementSireesh K
 

Similar to 7. copy2 in Symfony 4 (20)

Simple Markdown with Ecto and Protocols
Simple Markdown with Ecto and ProtocolsSimple Markdown with Ecto and Protocols
Simple Markdown with Ecto and Protocols
 
13. view data
13. view data13. view data
13. view data
 
DRYing Up Rails Views and Controllers
DRYing Up Rails Views and ControllersDRYing Up Rails Views and Controllers
DRYing Up Rails Views and Controllers
 
18. images in symfony 4
18. images in symfony 418. images in symfony 4
18. images in symfony 4
 
JavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptxJavaScriptL18 [Autosaved].pptx
JavaScriptL18 [Autosaved].pptx
 
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2
 
Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress Use Symfony2 components inside WordPress
Use Symfony2 components inside WordPress
 
PhpBB meets Symfony2
PhpBB meets Symfony2PhpBB meets Symfony2
PhpBB meets Symfony2
 
Flask – Python
Flask – PythonFlask – Python
Flask – Python
 
Flask intro - ROSEdu web workshops
Flask intro - ROSEdu web workshopsFlask intro - ROSEdu web workshops
Flask intro - ROSEdu web workshops
 
Codegnitorppt
CodegnitorpptCodegnitorppt
Codegnitorppt
 
Polymer 1.0
Polymer 1.0Polymer 1.0
Polymer 1.0
 
What you need to know bout html5
What you need to know bout html5What you need to know bout html5
What you need to know bout html5
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic template
 
Html5 intro
Html5 introHtml5 intro
Html5 intro
 
1 Introduction to PHP Overview This lab walks y.docx
1  Introduction to PHP Overview This lab walks y.docx1  Introduction to PHP Overview This lab walks y.docx
1 Introduction to PHP Overview This lab walks y.docx
 
HTML & CSS 2017
HTML & CSS 2017HTML & CSS 2017
HTML & CSS 2017
 
[In Control 2010] HTML5
[In Control 2010] HTML5[In Control 2010] HTML5
[In Control 2010] HTML5
 
Rails Antipatterns | Open Session with Chad Pytel
Rails Antipatterns | Open Session with Chad Pytel Rails Antipatterns | Open Session with Chad Pytel
Rails Antipatterns | Open Session with Chad Pytel
 
Js placement
Js placementJs placement
Js placement
 

More from Razvan Raducanu, PhD (20)

12. edit record
12. edit record12. edit record
12. edit record
 
11. delete record
11. delete record11. delete record
11. delete record
 
10. view one record
10. view one record10. view one record
10. view one record
 
9. add new record
9. add new record9. add new record
9. add new record
 
8. vederea inregistrarilor
8. vederea inregistrarilor8. vederea inregistrarilor
8. vederea inregistrarilor
 
7. copy1
7. copy17. copy1
7. copy1
 
6. hello popescu 2
6. hello popescu 26. hello popescu 2
6. hello popescu 2
 
5. hello popescu
5. hello popescu5. hello popescu
5. hello popescu
 
4. forme in zend framework 3
4. forme in zend framework 34. forme in zend framework 3
4. forme in zend framework 3
 
3. trimiterea datelor la vederi
3. trimiterea datelor la vederi3. trimiterea datelor la vederi
3. trimiterea datelor la vederi
 
2.routing in zend framework 3
2.routing in zend framework 32.routing in zend framework 3
2.routing in zend framework 3
 
1. zend framework intro
1. zend framework intro1. zend framework intro
1. zend framework intro
 
17. delete data
17. delete data17. delete data
17. delete data
 
16. edit data
16. edit data16. edit data
16. edit data
 
15. view single data
15. view single data15. view single data
15. view single data
 
14. add data in symfony4
14. add data in symfony4 14. add data in symfony4
14. add data in symfony4
 
12.doctrine view data
12.doctrine view data12.doctrine view data
12.doctrine view data
 
10. add in Symfony 4
10. add in Symfony 410. add in Symfony 4
10. add in Symfony 4
 
1.symfony 4 intro
1.symfony 4 intro1.symfony 4 intro
1.symfony 4 intro
 
23.simple login with sessions in laravel 5
23.simple login with sessions in laravel 523.simple login with sessions in laravel 5
23.simple login with sessions in laravel 5
 

Recently uploaded

On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 

Recently uploaded (20)

On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 

7. copy2 in Symfony 4

  • 2. • composer create-project symfony/website-skeleton symfony5 • cd symfony5 • php bin/console make:controller >CopyController • composer php/bin server:start • http://localhost:8000/copy
  • 3. Vederea base.html.twig <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>{% block title %}Welcome!{% endblock %}</title> {% block stylesheets %}{% endblock %} </head> <body bgcolor="aquamarine"> {% block body %}{% endblock %} {% block javascripts %}{% endblock %} </body> </html>
  • 4. Vederea form/index.html.twig {% extends 'base.html.twig' %} {% block title %}Copy!{% endblock %} {% block body %} {{head|raw}} {{ form_start(form) }} {{ form_row(form.nume1,{'value': value1 }) }} {{ form_row(form.submit) }} {{ form_row(form.nume2,{'value': value }) }} {{ form_end(form) }} {% endblock %}
  • 5. Controller-ul CopyController <?php namespace AppController; use SymfonyComponentRoutingAnnotationRoute; use SymfonyBundleFrameworkBundleControllerController; use SymfonyComponentHttpFoundationRequest; use SymfonyComponentHttpFoundationResponse; use SymfonyComponentForm; use SymfonyComponentFormExtensionCoreTypeTextType; use SymfonyComponentFormExtensionCoreTypeTextareaType; use SymfonyComponentFormExtensionCoreTypeSubmitType;
  • 6. class CopyController extends Controller { /** * @Route("/copy", name="copy") */ public function index(Request $request) { $data=[]; $form=$this->createFormBuilder() ->add('nume1', TextType::class, array('attr'=>array('size'=>'30','placeholder'=>'bau bau'))) ->add('submit', SubmitType::class) ->add('nume2', TextareaType::class, array('attr'=>array('size'=>'30','placeholder'=>'bau bau'),'required' => false)) ->getForm(); $form->handleRequest($request); $data['head']="<h1>Input your name</h1>"; $data['form']=$form->createView();
  • 7. if($form->isSubmitted()){ // $data['value']=$request->request->all(); $data['value'] = $form->get('nume1')->getData(); $data['value1'] = $form->get('nume2')->getData();; }else { $data['value']=''; $data['value1']=''; } return $this->render('copy/index.html.twig', $data); } }