helmut2509 Posted September 28, 2017 Share 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? Link to comment Share on other sites More sharing options...
abdus Posted September 28, 2017 Share Posted September 28, 2017 Call it like \ProcessWire\wire()->config Or add <?php namespace ProcessWire; at the top of your file. 2 Link to comment Share on other sites More sharing options...
helmut2509 Posted September 28, 2017 Author Share 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...." Link to comment Share on other sites More sharing options...
abdus Posted September 28, 2017 Share 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 Link to comment Share on other sites More sharing options...
helmut2509 Posted September 28, 2017 Author Share 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! 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