Lila Avenue

Website Projects

Build a CMS Step 4a

← Return to Build a CMS

Creating building blocks for pages

Currently, each page shows only content dedicated to that page. In this step we will allow pages to display multiple pieces of content.

Let's save our current content in a new folder called 'blocks' - these are building blocks for a page.

Instead of dedicated content, our page files will now show a list of blocks, separated by commas. We can use the PHP array functions to display them in the order they appear in the page file.

For example, the 'home' page:

home file contents

data folder

CMS-04 data folder
2 college cats CLICK HERE FOR DEMO

Blocks

Pages

admin

Inc