Answer the question
In order to leave comments, you need to log in
How does the Blade templating engine work?
Good day, gentlemen developers. Relatively recently I found my first job in IT. Remote work, small team. We use laravel , php , js . We make a website builder for sales. I'm in charge of design. Everything is bad with the backend. Of the skills - html, css, bs4, well, js at the level of working with the DOM.
So, closer to the point. when trying to style one of the pages of the project, there was a problem of misunderstanding of some @section, @show, @extends , etc. Later it turned out that these are attributes of the Blade template engine.. I read the documentation, I understood the principle of operation. But this is only on paper. In reality, changing the content within a section (even just changing the text in the link) does not change anything.
I will explain using the project menu as an example.
I have a views folder . It has a templates folder that contains funnels.blade.php .
In this file, the @extends attribute (correct me if I'm calling it wrong) "calls" layout_clientpage.blade.php , which is located in the layouts folder . After changing the link text of one of the buttons from "Monitor" to "Monitor 1", nothing changed. The menu on the local server still shows "Monitor" . I would understand if I erased something superfluous, but I can’t even change the text in the link. Explain to the neophyte what he is doing wrong.
I don't want to lose my first job :(
Answer the question
In order to leave comments, you need to log in
Similar to the work of other template engines. For example, on Fenom in Modx The
paths to the files are separated by a dot relative to views
. It's also useful to clear the cache after the update.
1. If you are in charge of design, then you have nothing to do in blade templates. Backenders and frontenders can hang out there, but not designers.
2. Template engines work in such a way that the templates themselves are then compiled into a regular php / html code and cached. This cache is used to render the page (this improves performance). Now, if you changed the template, but did not clear the cache, you will not see the changes.
3. To clear the cache, as antimind already wrote, you need to run the php artisan view:clear command in the console at the root of the project
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question