helmut2509 Posted September 28, 2017 Posted September 28, 2017 Hello, I want to access the $config variable outside the template directory. so I tried $config = wire('config'); ...but got this error: " PHP Fatal error: Uncaught Error: Call to undefined function wire() " What do I have to do?
abdus Posted September 28, 2017 Posted September 28, 2017 Call it like \ProcessWire\wire()->config Or add <?php namespace ProcessWire; at the top of your file. 2
helmut2509 Posted September 28, 2017 Author Posted September 28, 2017 51 minutes ago, abdus said: Call it like \ProcessWire\wire()->config Or add <?php namespace ProcessWire; at the top of your file. Unfortunately this does not work. In both cases I get the error: " Uncaught Error: Call to undefined function ProcessWire\\wire() in...."
abdus Posted September 28, 2017 Posted September 28, 2017 Is this file called by PW? If not, wire() will not be defined and you'll need to bootstrap PW into your script. https://processwire.com/api/include/ 1
helmut2509 Posted September 28, 2017 Author Posted September 28, 2017 41 minutes ago, abdus said: Is this file called by PW? If not, wire() will not be defined and you'll need to bootstrap PW into your script. https://processwire.com/api/include/ that's the solution. thanx abdus!
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