thetuningspoon Posted March 14, 2013 Share Posted March 14, 2013 I am trying to edit a page through the API. I can echo fields from the page and I can perform the save() function, but if I try to make changes to the page first, it gives me a bunch of illegal offset errors like this: Warning: Illegal offset type in isset or empty in /opt/disk1/www/mywebsite.com/wire/core/Data.php on line 41 Here is my code: $my_page = $pages->get($my_page_id); $my_page->setOutputFormatting(false); $my_page->time_field = time(); $my_page->removeStatus(Page::statusUnpublished); echo "page title: " . $order->title ."\n"; // this works $my_page->save(); // fails Any ideas? Thanks in advance. Link to comment Share on other sites More sharing options...
adrian Posted March 14, 2013 Share Posted March 14, 2013 I don't think "time_field" is valid. Does the following work as is? ie, does it change remove the unpublished status? $my_page = $pages->get($my_page_id); $my_page->setOutputFormatting(false); $my_page->removeStatus(Page::statusUnpublished); $my_page->save(); What does: echo $my_page->id return? Are you sure that $my_page_id is set correctly? Link to comment Share on other sites More sharing options...
thetuningspoon Posted March 14, 2013 Author Share Posted March 14, 2013 $my_page->id gives me "1649", which looks like a proper page id to me. $time_field is just a field on the page. (It's not even actually called that in my program). I can't even do $my_page->removeStatus(Page::statusUnpublished); without getting the errors. Link to comment Share on other sites More sharing options...
adrian Posted March 14, 2013 Share Posted March 14, 2013 Ok, not really sure what to suggest now - might need someone morre experienced with PW to step in, but when you say you can save the page so long as you don't make any changes, are you sure the page is saving? Is the modified field being updated? Can you make any other changes to the page, like change the body or other simple field? Link to comment Share on other sites More sharing options...
teppo Posted March 14, 2013 Share Posted March 14, 2013 Just couple of quick questions: any specific modules you've installed, apart from those included by default -- and which version of PW are you using? Link to comment Share on other sites More sharing options...
thetuningspoon Posted March 15, 2013 Author Share Posted March 15, 2013 I'm using 2.3. It turns out it was a module (not sure which one) that was messing with things. But it's working now, so thanks for the suggestion, teppo! 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