Making Websites With October CMS - Part 29 - PHP block

In this episode I'm going to show you how to use PHP block in your October CMS theme to create simple and complex queries and display them on your pages.

October CMS has three main parts of it's templates. Configuration block where information about your page is contained. Twig block where your markup goes, an the one we didn't talk about - PHP block.

And PHP block is used for just that, writing PHP at the start of your template. Which is very useful if you want to prepare some data before your page renders and then display it.

Usually this means that you would be making queries of varying complexity. I would compare this to something like Custom Queries in WordPress.

As you will see, this PHP block will help you a lot when making October CMS site.

Download code