Jump to content

What's in your settings page?


Boost
 Share

Recommended Posts

  • 2 weeks later...

Hi;

i think what you're speaking about is the _main.php file in which we usually put what's common i nearly all the pages, html head,
in the head yes you'll find the metas, the og, analytics or matomo for me ?  the css links, sometimes a few js vars you want to have everywhere

then comes the header (can be different from the homepage and the others using either s simple php if $page->id == 1 or taking advantage of pw markup regions (this is true for other parts you may need in some pages and not for all of them, markup regions are really a killing the game stuff ? ) the nav, search engine, etc

to the bottom of course, the footer, the script href and so on

and in the middle, the div with an id which will be filled by pages (home page included) content

working like this allows you for any new website to have a ready to go working environment changing very few things, name of the css, js files, add or remove those you do or don't use

i usually also use the _init.php to store things i always need and sometimes my ready.php file for some hooks but this is maybe a little outside your question ?

have a nice day

Link to comment
Share on other sites

On 12/1/2023 at 2:14 PM, Boost said:

Hei,

I read in the forum that some of you have a "global settings" page. I'm curious to know what you have there. Analytics tags? Menus?

Cheers

"Everything" in ProcessWire is a page. So for example I have a "Global Settings" Page (which is actually a page!) in my backend here:

image.png.ea6dd643310bf67069d57084bf2d1b0a.png

Inside this page you can add whatever fields you like to store data that you want to use "globally" on your website.

For example text blocks, or repeaters that contain page references to use as a footer menu:

image.thumb.png.0158f77521984272a5fb01858032956f.png

In my ready.php file have this global variable that acts as a page reference to the settings page:

// Global Settings Page as API variable
$wire->wire('globalSettings', $pages->get('template=global-settings'));

Then on any template file I can access a field on that global settings page like this:

<?= $globalSettings->body; ?>
  • Like 5
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...