Boost Posted December 1, 2023 Share Posted December 1, 2023 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 1 Link to comment Share on other sites More sharing options...
virtualgadjo Posted December 12, 2023 Share Posted December 12, 2023 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 More sharing options...
Stefanowitsch Posted December 13, 2023 Share Posted December 13, 2023 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: 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: 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; ?> 5 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now