How to structure content as data containers?

Hi there,

A sports club offers activities in several halls. I want to be able to store the information for each of these rooms in files and group these files in a single directory. So here is the structure :


I pick it up when I need it for the content of the site.

But this data must be private and not accessible by the average user, so there must be no URL leading to it. Not even a global :

The administrator should be able to manage these places as normal pages in the Panel.

I cannot achieve this since :

  • the Internet user has access to the URL /halls even when the /content/halls/hall_B/hall.txt file does not exist. Then the default template is used.
  • the administrator also has access to this page in administration via the default blueprint.

The use of pages as data containers is often mentioned in the documentation but I have not found any examples!

So how can I store information internally?

Translated with (free version)

What you need is a route that blocks access to these pages to site visitors.

'routes' => [
        'pattern' => ['halls', 'halls/(:all)'],
        'action'  => function() {
            return go('error');

This will block frontend access to the pages, but they will still be usable in the Panel.

Yes… Unfortunately

But it does not solve the Panel’s behaviour. And because of this administrator can access to a page that doesn’t exist. This is quite confusing…

I’m afraid I don’t quite understand the problem. Which page does not exist? Above, you say that the admin should be able to manage these pages?

I mean the admin don’t have to see/access/manage the halls page as they do not exist and have really no meaning. When the admin is currently managing a hall’s page – let’s say hallA–, there is a way to access to the “halls” page on the upper menu: website/halls/hallA.

By the way, thank you for your help and happy new year!

Yep, that’s actually something you can hardly avoid, I think. You can set that page to read: false, but then you get an error in the Panel when the user tries to access that page.

Maybe a route:before hook can throw an exception before the user tries to edit that page. I usually put a list of all the subpages into this container page.

You are welcome. And to you, too! :fireworks:

What you could do in addition to setting read: false is disable the breadcrumb link/all links to that page with some custom Panel CSS.

a[href$="panel/pages/halls"] {
1 Like