Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In the first lecture, we will talk about how do you return HTML from your roots and the spoiler alert
we will be doing that using the blade templating engine.
But before we get to what is our templating engine, let's look at the naive way it can be done so you
can try to surround the text you are returning using HTML, for example, with an H1 tag, save the
changes refresh and indeed that works.
The whole page text is now surrounded with an H1 tag.
Now, I will tell you immediately that this is not a good idea in 2020, you care about the separation
of concerns and generating HTML is our responsibility of the view.
So what is the view?
Let's take a look at the diagram that we have here.
So it all starts with a request to your website.
So there is a request.
It gets routed to our controller.
So, controller, that's your function here.
And then controller is using both model and view, model is some kind of data abstraction, usually
on the database and view in our case.
Well, this is a blade templating engine.
So the view layer is responsible for generating output or more specifically, generating the HDMI and
your pages render.
So we said that that blade is a powerful templating engine in Laravel.
And those templates let you use special template language that works well inside HTML.
Do, for example, conditionally render use loops or to have common layout on different pages.
So it's much more practical and easy to use than mixing up logic with HTML directly.
Now, separating the view layer makes it easy to change what is being rendered without making any changes
to the model and controller logic.
Now, you should also know that the blade templates are compiled and cached until you make any changes
to them.
So they give almost zero overhead by convention.
Blade templates are stored inside resources reviews folder and they are basically HTML5 with extra blade
syntax called directive's and they should be given a Blade BCP extension to render a response using
the Blades template return the result of the view function with the template name as the first parameter.
And optionally and the extra data that you might want to pass through the template in the second parameter
that is unary, will get to plussing data to templates later.
Now, the view function assumes that the template name you give is based inside the resources views
folder.
And when specifying our template name, make sure not to add the Blade BHB extension.
Now, here is a hint, you should name your plate templates exactly the same as are the names of the
routes in which they are used later.
This would be very easy to figure out which template belongs to which route.
So we need to create our template file that we have referenced here, the home index.
Now, you should know that when you are using DOT in the name of the blade template, this actually
means that there is some nested folder structure.
So instead of creating column DOT Index Dot Blade HP, we would create a home folder inside the views
folder and in it we will make an index, a sort of index blade file.
There it is now let's have some HTML boilerplate.
And inside the body, let's put H1 and Hello World, or whatever you would like, save the changes and
now the contents of this blade template should be rendered whenever we go to this page.
So let's save all the changes, go back to the browser.
And indeed, there it is.
You can see some additional attacks that were added and also the structure of the document.
So that was the introduction to the blade template, we will be, of course, talking about all the
aspects of using and creating blade templates in your applications in the next lecture's.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.