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.


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:


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


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.

What is pretty much biggest difference it's the way they works - include will include content of your other template to a final template, partial will call volt method to do all th of it. So pretty much like above. If you want then update this included view you must to remember about clearing cache for also final view.