I'm new to Laravel and want to learn how to use the Blade template system properly, but i cant wrap my head around the difference between @section and @yield. I've been reading the docs : https://laravel.com/docs/5.7/blade.
But it's not explaining the differences and how to use them properly. I've been reading posts in other forums too like this one :
https://laravel.io/forum/09-02-2014-using-section-and-yield
But still i'm a bit confused.
For example right now i'm creating an app that have multiple pages with commun pieces between them, so for now i get that i have to create a common layout for this pages, but when to use @section and when do i have to use @yield ?
for example if i have a page like so :
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title></title>
//Common CSS between pages
<link href="" rel="stylesheet">
//Changing CSS between pages
<link href="" rel="stylesheet">
</head>
<body>
//the content stay the same !
<div id="app">
<span id="some_style">hello world !</span>
</div>
<script>
//common JS
<script src="">
//Changing JS between pages
<script src="">
</script>
</body>
</html>
How can i organise it using the blade templating?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire