S
S
Sergey Gutovsky2018-06-26 13:49:25
Laravel
Sergey Gutovsky, 2018-06-26 13:49:25

What is the correct way to include a template in a file?

I'm using Blade Engine.
I have a loop where a template is added to a file using the @include.

@include('/skills/partials/_progress_bar_success', [
    'score' => $skill->score,
    'positive' => $task->pivot->positive
])

The fact is that this template is loaded every time anew. That is, having a collection of 15 models, I will have 15 views connected, which is not very good. How can I make the template connect once?
It is important that values ​​are passed to it.
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zxscv, 2018-07-06
@zxscv

I don't think you should think about the implementation details of @include (this is not a php include), because the template engine is chosen precisely for convenience, while sacrificing slightly performance. If in some task every byte of RAM and a microsecond of processor time is important to you, then do not use the template engine at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question