suntrop Posted June 6, 2016 Share Posted June 6, 2016 Has anything changed from v. 2.5 to v. 3 when I include/bootstrap PW from another file? The last time I used this in PW 2.5.2 my code worked, but now it doesn't. Some of the API vars are not present and none of the classes are found. require '../index.php'; echo $wire->pages->get("/")->name; // works echo wire('pages')->get("/")->name; // doesn't work $u = new User(); // Error: Class 'User' not found Couldn't find infos if there are changes on how to bootstrap PW in version 3 Link to comment Share on other sites More sharing options...
horst Posted June 6, 2016 Share Posted June 6, 2016 (edited) I think it has to do with namespace. Have you tried to prefix your file with <?php namespace ProcessWire; or maybe it also works if you add <?php use ProcessWire; ---- Or you can call it $u = new ProcessWire\User(); Edited June 6, 2016 by horst 1 Link to comment Share on other sites More sharing options...
suntrop Posted June 6, 2016 Author Share Posted June 6, 2016 I think it has to do with namespace. Have you tried to prefix your file with <?php namespace ProcessWire; horst, thanks! That one 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