This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi guys
I'm pretty new to OctoberCMS and I'm a bit confused about the best practice of using partial or content?
I'm familiar that both blocks can be re-used but I have noticed that the following code: {{ 'assets/images/test.jpg'|theme }} doesn't work in content-blocks. So, this implies content blocks are only for text (and simple HTML)?
I'm very interested to hear your experience, adwise and best-practice on this subject. I can't be the only one who am or had been struggling with the distinguish between those two types.
Last updated
Hello,
The way I have explained it in the past is that a partial is a reusable block of your template. For example, the header, footer, and sidebar of my template are partials. The word template is important here, in that it means that a partial allows for twig (the templating language that allows for {{ 'assets/images/test.jpg'|theme }}
).
Content is simply that, benign content for the website. Maybe some hero content that you will be repeating throughout the website. Or maybe a snippet of HTML code that will display your logo so you can place it around the website by simply calling that content block.
Hopefully that helps a bit with the semantics.
Last updated
Thanks for your reply.
But I still don't see a reason for not be able to use Twig in Content blocks though?
As per i know ............................"Content" contains non dynamic data i.e it will not contain any twigs as this file will be not parsed . Only it will be reflected as HTML and text.
If the content will not be parsed for twig then definitely it will effect the execution timing.
Last updated
Content is static content - for example just paragraphs of text. They're meant to allow you to rapidly update your pages without needing to ever touch code or worry about breaking anything. They really should have a WYSIWYG on it by default but we have plugins for that.
Allowing Twig would make them dynamic - that's not what content blocks are for, that's meant for partials.
Content blocks are a concept taken from Lemonstand 1. You'll understand a bit more when the Pages plugin gets more fleshed out. Both you and your clients are going to love them. They're extremely handy when used correctly.
If I understand them correctly... then the pages plugin could eventually evolve into something like: https://buildwithcraft.com/features/matrix ...
Right?
1-7 of 7