Jump to content

Recommended Posts

Posted

Hi community, thanks for the great work you do ?

I´m looking for a global field which can be used in the footer and has only one instance for all pages. So I´m kind of looking for "One field to rule them all".
 

Reason for my question: The website I´m currently building has one footer for all pages. The content of the footer should be dynamic - therefore I made a global field which is automatically inserted into each page.
Problem: if I want to change something in the footer, I have to do it for all fields, because each field has it´s own instance.

Question: is it possible to have one global field in which changes the content for the footer of all pages?

In most CMS Systems a simple solution to this is often impossible, I hope that processwire is different ?

All the best,
Daniel
 

Posted
2 hours ago, daniel_puehringer said:

Question: is it possible to have one global field in which changes the content for the footer of all pages?

Hi Daniel! 

It sure is. A simple way to do it is to have the field on only ONE page, like the homepage or a "settings" page and get this page's field content in your footer template. 

For instance, if you have this field on your homepage, called "footer_text", you can get it this way:

// On your footer.php file

//Get the homepage reference
$homepage = $pages->get('/');

// Let's say your field is called "footer_text"
echo $homepage->footer_text;


// Docs: https://processwire.com/api/ref/pages/get/

 

  • Like 2
  • 3 weeks later...
Posted

@daniel_puehringer as Sergio already mentioned, I have a common practice to create a page I call "Settings" which I do not publish or allow for search results to list.

In that page I generally attach any fields that I consider global for the entire website (phone numbers, address, emails etc.) For the Settings page to work, I am creating a template without an actual file which I also call Settings to allow me to faster orient what is what and assign it to the Settings page.

It works a bit like WordPress or any other platform where you have a main Theme Admin which is basically used for global configuration. Should you prefer to make the config page more user-friendly, feel free to separate the configuration to tabs (e.g. Home, Contact US, About us etc.) in which you would attach fields that are specific to that page.

The beauty of ProcessWire (and its force of course) is that it allows you super easily and quickly to organize every aspect in one way or another that you see fit best for the purpose.

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
×
×
  • Create New...