View data in Symfony4
• php bin/console make:controller
>DataController
• composer php/bin server:start
• http://localhost:8000/data
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 data/index.html.twig
{% extends 'base.html.twig' %}
{% block title %}View data{% endblock %}
{% block body %}
<table>
<tr>
<th>id</th>
<th>nume</th>
<th>culoare</th>
<th>marime</th>
<th>pret</th>
</tr>
{% for key in flowers %}
<tr>
<td>{{ key.id }}</td>
<td>{{ key.nume }}</td>
<td>{{ key.culoare }}</td>
<td> {{ key.marime }}</td>
<td>{{ key.pret }}</td>
</tr>
{% endfor %}
</table>
{% endblock %}
• php bin/console make:controller
>DataController
Controller-ul DataController
<?php
namespace AppController;
use SymfonyComponentRoutingAnnotationRoute;
use
SymfonyBundleFrameworkBundleControllerController;
use SymfonyComponentHttpFoundationRequest;
use AppEntityFlower;
class DataController extends Controller
{
/**
* @Route("/data", name="data")
*/
public function index(Request $request)
{
$flower = $this->getDoctrine()->getRepository(Flower::class)->findAll();
return $this->render('data/index.html.twig', array('flowers'=>$flower));
}
}

More Related Content

PPSX
web design and jQuery introduction in persian
RTF
0016text[1].Txt.Xhtml
RTF
0017text[1].Txt.Xhtml
PPTX
14. add data in symfony4
PDF
Quan Head Tag Presentation
RTF
0035text[1].Txt.Xhtml
PPTX
16. CodeIgniter stergerea inregistrarilor
PDF
Training in Asp.net mvc3 platform-apextgi,noidaAspnetmvc3 j query
web design and jQuery introduction in persian
0016text[1].Txt.Xhtml
0017text[1].Txt.Xhtml
14. add data in symfony4
Quan Head Tag Presentation
0035text[1].Txt.Xhtml
16. CodeIgniter stergerea inregistrarilor
Training in Asp.net mvc3 platform-apextgi,noidaAspnetmvc3 j query

What's hot (19)

PDF
Creating web api and consuming part 2
PDF
Fluid content rendering
PDF
C A S Sample Php
PPTX
8. Php MongoDB stergerea unui document
RTF
Document
PDF
Delete statement in PHP
TXT
PPTX
Training in Asp.net mvc3 platform-apextgi,noida
PPTX
6. Php MongoDB adaugarea unui document
DOCX
Cara memperbaiki google
PDF
Tour of Ecto March 2017 Dave Lucia
PPT
Basics tags for HTML
PDF
Jquery mobile2
PDF
HTML Lecture Part 2 of 2
PPTX
9. Php MongoDB cautarea unui document
DOC
Teri's Resume
KEY
Eu odeio OpenSocial
PDF
Index of jquery template 2 Minuteman Summer Web Dev.
Creating web api and consuming part 2
Fluid content rendering
C A S Sample Php
8. Php MongoDB stergerea unui document
Document
Delete statement in PHP
Training in Asp.net mvc3 platform-apextgi,noida
6. Php MongoDB adaugarea unui document
Cara memperbaiki google
Tour of Ecto March 2017 Dave Lucia
Basics tags for HTML
Jquery mobile2
HTML Lecture Part 2 of 2
9. Php MongoDB cautarea unui document
Teri's Resume
Eu odeio OpenSocial
Index of jquery template 2 Minuteman Summer Web Dev.
Ad

Similar to 13. view data (10)

PPTX
15. view single data
PPTX
18. images in symfony 4
PPTX
1.symfony 4 intro
PPTX
5.hello popescu2
PPTX
17. delete data
PPTX
13. CodeIgniter vederea inregistrarilor3
PPTX
15.exemplu complet eloquent view add-edit-delete-search
PPTX
10. CodeIgniter vederea inregistrarilor
PPTX
12. CodeIgniter vederea inregistrarilor2
PPTX
4.hello popescu
15. view single data
18. images in symfony 4
1.symfony 4 intro
5.hello popescu2
17. delete data
13. CodeIgniter vederea inregistrarilor3
15.exemplu complet eloquent view add-edit-delete-search
10. CodeIgniter vederea inregistrarilor
12. CodeIgniter vederea inregistrarilor2
4.hello popescu
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
16. edit data
PPTX
12.doctrine view data
PPTX
11. move in Symfony 4
PPTX
10. add in Symfony 4
PPTX
9. lower in Symfony 4
PPTX
8. radio1 in Symfony 4
PPTX
7. copy2 in Symfony 4
PPTX
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
16. edit data
12.doctrine view data
11. move in Symfony 4
10. add in Symfony 4
9. lower in Symfony 4
8. radio1 in Symfony 4
7. copy2 in Symfony 4

Recently uploaded (20)

PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
IGGE1 Understanding the Self1234567891011
PPTX
Share_Module_2_Power_conflict_and_negotiation.pptx
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PPTX
Virtual and Augmented Reality in Current Scenario
PDF
Complications of Minimal Access-Surgery.pdf
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PPTX
20th Century Theater, Methods, History.pptx
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PPTX
Computer Architecture Input Output Memory.pptx
PDF
advance database management system book.pdf
PPTX
Introduction to pro and eukaryotes and differences.pptx
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
FORM 1 BIOLOGY MIND MAPS and their schemes
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
History, Philosophy and sociology of education (1).pptx
IGGE1 Understanding the Self1234567891011
Share_Module_2_Power_conflict_and_negotiation.pptx
Weekly quiz Compilation Jan -July 25.pdf
LDMMIA Reiki Yoga Finals Review Spring Summer
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Virtual and Augmented Reality in Current Scenario
Complications of Minimal Access-Surgery.pdf
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
20th Century Theater, Methods, History.pptx
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
Paper A Mock Exam 9_ Attempt review.pdf.
Computer Architecture Input Output Memory.pptx
advance database management system book.pdf
Introduction to pro and eukaryotes and differences.pptx

13. view data

  • 1. View data in Symfony4
  • 2. • php bin/console make:controller >DataController • composer php/bin server:start • http://localhost:8000/data
  • 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 data/index.html.twig {% extends 'base.html.twig' %} {% block title %}View data{% endblock %} {% block body %} <table> <tr> <th>id</th> <th>nume</th> <th>culoare</th> <th>marime</th> <th>pret</th> </tr> {% for key in flowers %} <tr> <td>{{ key.id }}</td> <td>{{ key.nume }}</td> <td>{{ key.culoare }}</td> <td> {{ key.marime }}</td> <td>{{ key.pret }}</td> </tr> {% endfor %} </table> {% endblock %}
  • 5. • php bin/console make:controller >DataController
  • 6. Controller-ul DataController <?php namespace AppController; use SymfonyComponentRoutingAnnotationRoute; use SymfonyBundleFrameworkBundleControllerController; use SymfonyComponentHttpFoundationRequest; use AppEntityFlower;
  • 7. class DataController extends Controller { /** * @Route("/data", name="data") */ public function index(Request $request) { $flower = $this->getDoctrine()->getRepository(Flower::class)->findAll(); return $this->render('data/index.html.twig', array('flowers'=>$flower)); } }