mav_medved Posted November 9, 2017 Share Posted November 9, 2017 Hi everyone! Function wire() doesn't work in PW3 api after including pw's index.php Trying to use it exactly the same I use it in pw2 api. <?php require_once('/path/to/pw/index.php'); $test = wire('pages')->find('parent_id=1019'); I'm getting an error: PHP Fatal error: Call to undefined function wire() Though https://processwire.com/api/include/ says I can use wire() function as before. Btw, this one works: $wire->pages->find('parent_id=1019'); But I want my old scripts work with wire() function in pw3. Any ideas what could be wrong? Link to comment Share on other sites More sharing options...
abdus Posted November 9, 2017 Share Posted November 9, 2017 29 minutes ago, mav_medved said: <?php Change this line to <?php namespace ProcessWire; With v3.0, all global functions are now under ProcessWire namespace, so you need to either declare namespace at the top or prefix function calls (\ProcessWire\wire() for instance) 4 1 Link to comment Share on other sites More sharing options...
mav_medved Posted November 9, 2017 Author Share Posted November 9, 2017 @abdus, oh, thank you! It works!) 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