nirgendswo Posted June 14, 2016 Share Posted June 14, 2016 Hello, i'm not really sure where this topic belongs, i hope my choice was right ;-) I want to handle the logo of a Site in the Backend. There is no Concept of "Root"-Site or Global Config. I could set a image field to the home, and build a Partial to get each time them Home, but i think this is a little bit ugly. Is there a way to set fields to a global context? Or create a Module that can handle fields without Pages? Best regards! Link to comment Share on other sites More sharing options...
adrian Posted June 14, 2016 Share Posted June 14, 2016 Hi @nirgendswo and welcome to the forums. You can store the image on the homepage (or a dedicated settings page) and define a variable that grabs the path to the logo: $logoUrl = $pages->get('/')->logo->url(); You can do this in a file that is included for all templates - perhaps and init.php - it really depends on how you are structuring your template files and how you are outputting. PS - you may also find this discussion useful: https://processwire.com/talk/topic/12198-modifying-config-property-eg-sitesettings-from-readyphp/ Link to comment Share on other sites More sharing options...
mr-fan Posted June 14, 2016 Share Posted June 14, 2016 Is there a way to set fields to a global context? In fact all fields and values are kind of global.... Adrian has all summarized perfect - create a hidden page call it /settings/ or use a new fieldset tab named settings on the /home/ page and using a init.php is the most easiest way to get there - more complex is to setup your own config vars. In Processwire it completly depends on you where you put in data and pull it out - very flexible and at the beginning very overwhelming at least for me.....many options to choose from the start. Welcome to forums (this is the place very the options for your get sorted right) regards mr-fan Link to comment Share on other sites More sharing options...
nirgendswo Posted June 14, 2016 Author Share Posted June 14, 2016 Thank you Both Okay, really simple "$pages->get('/')->logo", this API is great. Also the Idea with a hidden Page has his advantage! I will try! Best regards! 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