17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 763 Views |
-
version 2.3.0 rc1 - VirtualPage Status CMS error

27 November 2008 at 6:03am Last edited: 27 November 2008 6:03am
In the CMS, when clicking on a page that has a VirtualPage pointing to it, I get the following (popup) error:
ERROR [Notice]: Trying to get property of non-object
IN POST /admin/getitem?ID=11&ajax=1
Line 1117 in /undisclosedRoot/sapphire/core/model/SiteTree.phpSource
======
1108: // Status / message
1109: // Create a status message for multiple parents
1110: if($this->ID && is_numeric($this->ID)) {
1111: $linkedPages = DataObject::get("VirtualPage", "CopyContentFromID = $this->ID");
1112: }
1113:
1114: if(isset($linkedPages)) {
1115: foreach($linkedPages as $linkedPage) {
1116: $parentPage = $linkedPage->Parent;
* 1117: $parentPageTitle = $parentPage->Title;
1118:
1119: if($parentPage->ID) {
1120: $parentPageLinks[] = "<a class=\"cmsEditlink\"
href=\"admin/show/$linkedPage->ID\">{$parentPage->Title}</a>";
1121: } else {
1122: $parentPageLinks[] = "<a class=\"cmsEditlink\" href=\"admin/show/$linkedPage->ID\">" .
1123: _t('SiteTree.TOPLEVEL', 'Site Content (Top Level)') .<ul>SiteTree->getCMSFields(CMSMain)
line 375 of CMSMain.phpCMSMain->getEditForm(11)
line 740 of LeftAndMain.phpLeftAndMain->EditForm()
line 245 of LeftAndMain.phpLeftAndMain->getitem(HTTPRequest)
line 164 of Controller.phpController->handleAction(HTTPRequest)
line 107 of RequestHandler.phpRequestHandler->handleRequest(HTTPRequest)
line 124 of Controller.phpController->handleRequest(HTTPRequest)
line 246 of Director.phpDirector::handleRequest(HTTPRequest,Session)
line 106 of Director.phpDirector::direct(admin/getitem)
line 88 of main.php</ul>
Exception:
This will not happen when Page and its VirtualPage share the same parent, but in real life this will probably never be the casePossible solution:
It seems that in line 1117 $parentPage->Title is not an object because in line 1116 the $linkedPage->Parent property does not exist. $linkedPage has access to a Parent() method however, that will return a proper parentobject. Possible replacement in SiteTree.php line 1116:$parentPage = $linkedPage->Parent;
becomes (seems to be working):
$parentPage = $linkedPage->Parent();
Addition: status message
As far as I understand this code is meant to extend the status message, to tell the user that a page has VirtualPages pointing to it, and where they might be found. This statusmessage, that also holds information about the published state of a page, is never shown. This is not a bug, the code is commented, but gives an error when uncommented:line 1273:
//new NamedLabelField("Status", $message, "pageStatusMessage", true)I wanted to see what the message was all about so to show it in the reports section of the page I did the following. It works and didn't result in any errors as yet, but just as a temporary thing:
line 1253:
$tabReports = new TabSet('Reports',
$tabBacklinks =new Tab('Backlinks',
new LiteralField("Backlinks", $backlinks)
)
),becomes:
$tabReports = new TabSet('Reports',
$tabBacklinks =new Tab('Backlinks',
new LiteralField("Backlinks", $backlinks),
new LiteralField("Status", $message)
)
),
| 763 Views | ||
|
Page:
1
|
Go to Top |
