SlideShare a Scribd company logo
Lower/Upper
• composer create-project symfony/website-skeleton symfony7
• cd symfony7
• php bin/console make:controller
>LowerController
• 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 lower/index.html.twig
{% extends 'base.html.twig' %}
{% block title %}Lower{% endblock %}
{% block body %}
{{head|raw}}
{{ form_start(form) }}
{{ form_row(form.text1,{'value': value1 }) }}
{{ form_row(form.submit) }}
{{ form_row(form.text2,{'value': value2 }) }}
{{ form_row(form.radio) }}
{{ form_end(form) }}
{% endblock %}
Controller-ul LowerController
<?php
namespace AppController;
use SymfonyComponentRoutingAnnotationRoute;
use SymfonyBundleFrameworkBundleControllerController;
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentHttpFoundationResponse;
use SymfonyComponentForm;
use SymfonyComponentFormExtensionCoreTypeTextType;
use SymfonyComponentFormExtensionCoreTypeSubmitType;
use SymfonyComponentFormExtensionCoreTypeRadioType;
use SymfonyComponentFormExtensionCoreTypeChoiceType;
class LowerController extends Controller
{
/**
* @Route("/lower", name="lower")
*/
public function index(Request $request)
{
$data = [];
$form = $this->createFormBuilder()
->add('text1', TextType::class, array('attr' => array('size' => '30',
'placeholder' => 'bau bau')))
->add('submit', SubmitType::class)
->add('text2', TextType::class, array('attr' => array('size' => '30',
'placeholder' => 'bau bau'), 'required' => false))
->add('radio', ChoiceType::class, array(
'choices' => array('Lower' => true, 'Upper' => false),
'expanded' => true,
'multiple' => false,
))
->getForm();
$form->handleRequest($request);
$data['head'] = "<h1>Input your data</h1>";
$data['form'] = $form->createView();
if ($form->isSubmitted()) {
if ($form->get('radio')->getData() == 'lower') {
$data['value2'] = strtolower($form->get('text1')-
>getData());
} else {
$data['value2'] = strtoupper($form->get('text1')-
>getData());
}
$data['value1'] = '';
} else {
$data['value1'] = '';
$data['value2'] = '';
}
return $this->render('lower/index.html.twig', $data);

More Related Content

PPTX
7. copy2 in Symfony 4
PPTX
11. move in Symfony 4
PPTX
PPTX
4.hello popescu
PPTX
8. radio1 in Symfony 4
PPTX
5.hello popescu2
TXT
Pp checker
PDF
Fronted From Scratch - Supercharge Magento page speed
7. copy2 in Symfony 4
11. move in Symfony 4
4.hello popescu
8. radio1 in Symfony 4
5.hello popescu2
Pp checker
Fronted From Scratch - Supercharge Magento page speed

What's hot (20)

PPTX
Up & Running with Polymer
KEY
5 minutes on Html 5
PDF
Haml. New HTML? (RU)
PPTX
Build a Better Editing Experience with Advanced Custom Fields - #WCTO16
PPTX
Xaml novinky ve Windows 10
PPTX
Introduction to HAML
PDF
Intro to jquery
PPTX
rel=alternate, hreflang=x - International Duplicate Content Issues
PPTX
Haml in 5 minutes
PPT
シックス・アパート・フレームワーク
PDF
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
PPTX
Open course(programming languages) 20150318
PDF
Manipulating Magento - Meet Magento Belgium 2017
PDF
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
PDF
Dress Your WordPress with Child Themes
PDF
Black-Scholes Calculator on Web
ODP
SlideShare Instant
PPT
SlideShare Instant
Up & Running with Polymer
5 minutes on Html 5
Haml. New HTML? (RU)
Build a Better Editing Experience with Advanced Custom Fields - #WCTO16
Xaml novinky ve Windows 10
Introduction to HAML
Intro to jquery
rel=alternate, hreflang=x - International Duplicate Content Issues
Haml in 5 minutes
シックス・アパート・フレームワーク
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
Open course(programming languages) 20150318
Manipulating Magento - Meet Magento Belgium 2017
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
Dress Your WordPress with Child Themes
Black-Scholes Calculator on Web
SlideShare Instant
SlideShare Instant
Ad

More from Razvan Raducanu, PhD (20)

PPTX
12. edit record
PPTX
11. delete record
PPTX
10. view one record
PPTX
9. add new record
PPTX
8. vederea inregistrarilor
PPTX
PPTX
6. hello popescu 2
PPTX
5. hello popescu
PPTX
4. forme in zend framework 3
PPTX
3. trimiterea datelor la vederi
PPTX
2.routing in zend framework 3
PPTX
1. zend framework intro
PPTX
18. images in symfony 4
PPTX
17. delete data
PPTX
16. edit data
PPTX
15. view single data
PPTX
14. add data in symfony4
PPTX
13. view data
PPTX
12.doctrine view data
PPTX
10. add in Symfony 4
12. edit record
11. delete record
10. view one record
9. add new record
8. vederea inregistrarilor
6. hello popescu 2
5. hello popescu
4. forme in zend framework 3
3. trimiterea datelor la vederi
2.routing in zend framework 3
1. zend framework intro
18. images in symfony 4
17. delete data
16. edit data
15. view single data
14. add data in symfony4
13. view data
12.doctrine view data
10. add in Symfony 4
Ad

Recently uploaded (20)

PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
RMMM.pdf make it easy to upload and study
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Lesson notes of climatology university.
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Cell Types and Its function , kingdom of life
PPTX
Institutional Correction lecture only . . .
Renaissance Architecture: A Journey from Faith to Humanism
2.FourierTransform-ShortQuestionswithAnswers.pdf
Computing-Curriculum for Schools in Ghana
O5-L3 Freight Transport Ops (International) V1.pdf
GDM (1) (1).pptx small presentation for students
RMMM.pdf make it easy to upload and study
Microbial diseases, their pathogenesis and prophylaxis
FourierSeries-QuestionsWithAnswers(Part-A).pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
01-Introduction-to-Information-Management.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Insiders guide to clinical Medicine.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Pharma ospi slides which help in ospi learning
Lesson notes of climatology university.
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Cell Types and Its function , kingdom of life
Institutional Correction lecture only . . .

9. lower in Symfony 4

  • 2. • composer create-project symfony/website-skeleton symfony7 • cd symfony7 • php bin/console make:controller >LowerController • 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 lower/index.html.twig {% extends 'base.html.twig' %} {% block title %}Lower{% endblock %} {% block body %} {{head|raw}} {{ form_start(form) }} {{ form_row(form.text1,{'value': value1 }) }} {{ form_row(form.submit) }} {{ form_row(form.text2,{'value': value2 }) }} {{ form_row(form.radio) }} {{ form_end(form) }} {% endblock %}
  • 5. Controller-ul LowerController <?php namespace AppController; use SymfonyComponentRoutingAnnotationRoute; use SymfonyBundleFrameworkBundleControllerController; use SymfonyComponentHttpFoundationRequest; use SymfonyComponentHttpFoundationResponse; use SymfonyComponentForm; use SymfonyComponentFormExtensionCoreTypeTextType; use SymfonyComponentFormExtensionCoreTypeSubmitType; use SymfonyComponentFormExtensionCoreTypeRadioType; use SymfonyComponentFormExtensionCoreTypeChoiceType;
  • 6. class LowerController extends Controller { /** * @Route("/lower", name="lower") */ public function index(Request $request) { $data = []; $form = $this->createFormBuilder() ->add('text1', TextType::class, array('attr' => array('size' => '30', 'placeholder' => 'bau bau'))) ->add('submit', SubmitType::class) ->add('text2', TextType::class, array('attr' => array('size' => '30', 'placeholder' => 'bau bau'), 'required' => false)) ->add('radio', ChoiceType::class, array( 'choices' => array('Lower' => true, 'Upper' => false), 'expanded' => true, 'multiple' => false, )) ->getForm(); $form->handleRequest($request);
  • 7. $data['head'] = "<h1>Input your data</h1>"; $data['form'] = $form->createView(); if ($form->isSubmitted()) { if ($form->get('radio')->getData() == 'lower') { $data['value2'] = strtolower($form->get('text1')- >getData()); } else { $data['value2'] = strtoupper($form->get('text1')- >getData()); } $data['value1'] = ''; } else { $data['value1'] = ''; $data['value2'] = ''; } return $this->render('lower/index.html.twig', $data);