Page setAttribute Fatal Error
Permalink
I am attempting to set a predefined page attribute. The attribute is set as desired, however I receive a fatal error!
The error is caused by the setAttribute method. I can suppress it with:
@$oPage->setAttribute('map_location', 'test geocode');
The problem remains that I would like to preform some more actions after this. The PHP script is run by an AJAX call.
Any thoughts?
$oPage = Page::getByID($_POST['cID']); $oPage->setAttribute('map_location', 'test geocode');
<b>Fatal error</b>: Call to a member function getInstance() on a non-object in <b>/home/clarsys/public_html/mmwp/concrete/libraries/database_indexed_search.php</b> on line <b>137
The error is caused by the setAttribute method. I can suppress it with:
@$oPage->setAttribute('map_location', 'test geocode');
The problem remains that I would like to preform some more actions after this. The PHP script is run by an AJAX call.
Any thoughts?
have you sure you are not trying to access the file directly by HTTP?? You need to use the Concrete5 dispatcher to access Page::getById.
No, I wasn't attempting to access a file directly. The php script being called was loading the appropriate C5 header scripts.
I can't remember how it was resolved. Possibly the getByID method was inappropriate for using a cID.
I can't remember how it was resolved. Possibly the getByID method was inappropriate for using a cID.