Jump to content

Create new page with api from external script PW 3.0.25


fbg13
 Share

Recommended Posts

I'm trying to create a new page through a file outside of the PW system.

require('path/to/index.php');

$p = new Page();
$p->template = 'basic-page';
$p->parent = '/about/';
$p->title = 'Title';
$p->save();

Error:

Spoiler

Error:  Class 'Page' not found (line 5 of C:\Program Files (x86)\Ampps\www\pw\site\templates\bg.php)

This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged.

ERROR: application encountered an error and can not continue. Error was logged.

Echoing $wire->config->urls->assets works.

I'm executing the code from the command line.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...