Jump to content

How to do a Global Field?


shogun
 Share

Recommended Posts

Although you can't create a global field, you can access fields from any page on any template, so you could create a settings 'page' that isn't visible on the site, but holds any fields that you want to use globally, and then access them in every template eg:

$global = $pages->get('name=settings');

echo $global->myfield;

Remember that in Processwire, everything is a 'page', but it doesn't have to be an actual visible page on your site.

  • Like 4
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...