simon Posted February 14, 2017 Share Posted February 14, 2017 Hi guys, I treid to create a new page with a command line script. Unfortunately the Page class was not fount. Fatal error: Class 'Page' not found in *.php on line 6 How can I easily fix this? <?php include("../../index.php"); // include processwire bootstrap $page = new Page(); // create new page from api ... ?> Link to comment Share on other sites More sharing options...
adrian Posted February 14, 2017 Share Posted February 14, 2017 Sounds like a namespace issue because bootstrapped files don't get run through the file compiler you will either need to add namespace ProcessWire; to the top of the file, or do: $page = new \ProcessWire\Page(); to reference the ProcessWire namespace 2 Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 14, 2017 Share Posted February 14, 2017 Also you might skip the closing ?> if it's at the end of the file to keep trailing whitespace issues away. 1 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