So now let's understand templates in a little bit more depth.
So why exactly do we need templates.
So in the previous example we had a database.
And we have extracted the data from the database.
And we have displayed that data onto the web page using Http response.
So this is the kind of result which we get in case of
using a Http response to display the data from the database.
That is we have these items displayed over here on to the web page.
But as you could see, the format of this item is not good at all,
which means that the items are just displayed one after the other,
and there is no proper formatting, or there is no proper structure
to the web page in which these items are actually laid out.
So what if you actually want to display those items in a structured
manner like this?
So how exactly can you go ahead and do that?
So here's where templates actually come into picture.
So what exactly the templates do.
So let's say we have this database right here.
And from the database we extract the data.
So now in order to
structure the page or in order to layout the elements in a proper format
in a structured way, we need to have some sort of HTML to it.
So what HTML does is that HTML gives a structure to a web page,
so that the elements which are present on our web
page are actually laid out in a specific manner.
So the HTML is responsible for the layout and the structure of our web page.
Whereas the database is responsible for providing the data.
And what templates allow you to do is that template
allow you to combine these
two things together so that your web page not only has the data,
but it also has a proper structure or a proper layout.
So this
HTML part of your web page is called as the static part.
And that's because it's actually going to remain the same.
And the database part of your web page is called as the dynamic part.
And that's because the data is going to constantly change.
So now when you combine the static part
and the dynamic part together, you can do that using a template.
And that's exactly why we need to use a template.
So a template allows us to do is that they allow us to combine
static part with the dynamic part, and it renders it out as a single web page.
And this is exactly why we use a template.
So now let's go ahead and create a template
by taking an example in the upcoming lecture.
So thank you very much for watching and I'll see you guys next time.
Thank you.