thomas Posted August 19, 2014 Posted August 19, 2014 Hello, a long time ago I learned in this forum that a nice way of making something accessible throughout my site is public function ready() { $company = wire('pages')->get(...); $this->fuel->set("company", $company); } in a module. I use this so I only need to declare $company once and then use it in all of my templates. Now my question is twofold: - is this a good way of doing this? - I often use little scripts outside the template folder which bootstrap PW and do little things, mostly via Ajax or sometimes in the terminal. Now how can I make $company available to those? I tried a lot of combinations of wire('company'), $this->fuel->get and so on but no success. Who can help? Thanks, thomas
kongondo Posted August 19, 2014 Posted August 19, 2014 (edited) init.inc? http://processwire.com/docs/tutorials/how-to-structure-your-template-files/page4 Edit: Oops, maybe not. Read this too quickly. Thought you were referring to template files Edited August 19, 2014 by kongondo Corrected stuff
Soma Posted August 19, 2014 Posted August 19, 2014 Maybe define it on the init and not ready. Bootstrap doesn't trigger ready as its not web context. 2
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