Where's/how's the best way to put arrays which can be accessable on several pages?

Right now I have a few arrays which contain informations which is used for several pages with different templates, so i wonder if there’s another good place where to put them…

can you recommend one?

You can set arbitrary data using the config helper functions, in your config.php:

# config.php
c::set('your-arbitrary-data', [
  'key' => ['your' => 'data']
]);

# your-template.php
c::get('your-arbitrary-data')['key']; # -> ['your' => 'data']

Alternatively! You could store it in your site.yml blueprint and access it with my blueprint reader plugin, “Architect”:

# site.yml
title: Site
pages:
  template:
    - home
    - error
    - etc
files: true
fields:
  title:
    label: Site Name
    type: text
your-arbitrary-data:
  key:
    your: data

And in any of your templates:

Architect::blueprint('site')['your-arbitrary-data']; # -> ['key' => ['your' => 'data']]

Or you create an invisible page like /admin, where you can store subpages for all you want.

You can then store what you want within the /admin-page or its subpages (and subsubpages).


Good luck!

I think I’d go for the config file as already suggested by @AugustMiller