partial VS include

hi! what is the difference between 'partial' and 'includes' ? I've read phalcon documents but i did not understand ! Explain more friendly. thanks.



1.6k

what do you mean by includes ? can you give us an example ?

what do you mean by includes ? can you give us an example ?

look at this link: https://docs.phalconphp.com/3.4/en/volt#include



1.6k

yeah i never used it ( volt ) before

for what i learned partial can be used with either view format ( phtml or volt )

and can accept paramaters

i'm sure someone will help you



288

An important distinction is that a partial remains a dynamic include, whereas an include is more like a #include in C, which inserts the content of the included file into the one that is doing the including.

What this means in practice is that if A includes B and you change B but you don't rebuild A, your change will not take effect. In contrast, with a partial you can change B without needing to have volt recompile A.

If you always flush the template cache after a change to any template then using includes is fine, and it's easy enough to do that automatically after deploying a change to a live environment, but it's more of a pain to do in development. I'd recommend to stick to partials for that reason.