Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Opening CMS interface


Go to End


3 Posts   6292 Views

Avatar
KiwiJeff

Community Member, 2 Posts

4 July 2009 at 11:49pm

Edited: 04/07/2009 11:50pm

I have just installed v2.3.2 on XAMPP for Windows Version 1.7.1 and after logging into CMS instead of the site editor I got this warning screen (below). If someone can help me to get round this problem I would really appreciate it as I would love to improve my current website.

[Warning] Invalid argument supplied for foreach()
GET /SilverStripe/admin/

Line 174 in C:\xampp\htdocs\SilverStripe\sapphire\core\model\Hierarchy.php
Source

165 }
166 }
167
168 /**
169 * Ensure marked nodes that have children are also marked expanded.
170 * Call this after marking but before iterating over the tree.
171 */
172 protected function markingFinished() {
173 // Mark childless nodes as expanded.

174 foreach($this->markedNodes as $id => $node) {

175 if(!$node->isExpanded() && !$node->numChildren()) {
176 $node->markExpanded();
177 }
178 }
179 }
180

Trace

* Hierarchy->markingFinished()
* call_user_func_array(Array,Array)
Line 489 of Object.php
* Object->__call(markingFinished,Array)
* Forum->markingFinished()
Line 286 of Forum.php
* Forum->getChildrenAsUL(, "<li id=\"record-$child->ID\" class=\"" . $child->CMSTreeClasses($extraArg) . "\">" . "<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" class=\"" . $child->CMSTreeClasses($extraArg) . "\" title=\"Page type: ".$child->class."\" >" . ($child->TreeTitle()) . "</a>" ,CMSMain,1,AllChildrenIncludingDeleted,)
Line 56 of Hierarchy.php
* Hierarchy->getChildrenAsUL(, "<li id=\"record-$child->ID\" class=\"" . $child->CMSTreeClasses($extraArg) . "\">" . "<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" class=\"" . $child->CMSTreeClasses($extraArg) . "\" title=\"Page type: ".$child->class."\" >" . ($child->TreeTitle()) . "</a>" ,CMSMain,1,AllChildrenIncludingDeleted,)
* call_user_func_array(Array,Array)
Line 489 of Object.php
* Object->__call(getChildrenAsUL,Array)
* ForumHolder->getChildrenAsUL(, "<li id=\"record-$child->ID\" class=\"" . $child->CMSTreeClasses($extraArg) . "\">" . "<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" class=\"" . $child->CMSTreeClasses($extraArg) . "\" title=\"Page type: ".$child->class."\" >" . ($child->TreeTitle()) . "</a>" ,CMSMain,1,AllChildrenIncludingDeleted,)
Line 56 of Hierarchy.php
* Hierarchy->getChildrenAsUL(, "<li id=\"record-$child->ID\" class=\"" . $child->CMSTreeClasses($extraArg) . "\">" . "<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" class=\"" . $child->CMSTreeClasses($extraArg) . "\" title=\"Page type: ".$child->class."\" >" . ($child->TreeTitle()) . "</a>" ,CMSMain,1,AllChildrenIncludingDeleted)
* call_user_func_array(Array,Array)
Line 489 of Object.php
* Object->__call(getChildrenAsUL,Array)
* SiteTree->getChildrenAsUL(, "<li id=\"record-$child->ID\" class=\"" . $child->CMSTreeClasses($extraArg) . "\">" . "<a href=\"" . Director::link(substr($extraArg->Link(),0,-1), "show", $child->ID) . "\" class=\"" . $child->CMSTreeClasses($extraArg) . "\" title=\"Page type: ".$child->class."\" >" . ($child->TreeTitle()) . "</a>" ,CMSMain,1,AllChildrenIncludingDeleted)
Line 523 of LeftAndMain.php
* LeftAndMain->getSiteTreeFor(SiteTree)
Line 160 of CMSMain.php
* CMSMain->SiteTreeAsUL()
* call_user_func_array(Array,Array)
Line 408 of ViewableData.php
* ViewableData->XML_val(SiteTreeAsUL,,1)
Line 294 of .cacheC..xampp.htdocs.SilverStripe.cms.templates.Includes.CMSMain_left.ss
* include(C:\Documents and Settings\Owner\Local Settings\Temp\silverstripe-cacheC--xampp-htdocs-SilverStripe\.cacheC..xampp.htdocs.SilverStripe.cms.templates.Includes.CMSMain_left.ss)
Line 354 of SSViewer.php
* SSViewer->process(CMSMain)
Line 773 of ViewableData.php
* ViewableData->renderWith(Array)
Line 480 of LeftAndMain.php
* LeftAndMain->Left()
* call_user_func_array(Array,Array)
Line 408 of ViewableData.php
* ViewableData->XML_val(Left,,1)
Line 59 of .cacheC..xampp.htdocs.SilverStripe.cms.templates.LeftAndMain.ss
* include(C:\Documents and Settings\Owner\Local Settings\Temp\silverstripe-cacheC--xampp-htdocs-SilverStripe\.cacheC..xampp.htdocs.SilverStripe.cms.templates.LeftAndMain.ss)
Line 354 of SSViewer.php
* SSViewer->process(CMSMain)
Line 175 of Controller.php
* Controller->handleAction(HTTPRequest)
Line 129 of RequestHandler.php
* RequestHandler->handleRequest(HTTPRequest)
Line 122 of Controller.php
* Controller->handleRequest(HTTPRequest)
Line 277 of Director.php
* Director::handleRequest(HTTPRequest,Session)
Line 121 of Director.php
* Director::direct(/admin/)
Line 118 of main.php

Avatar
Sam

Administrator, 690 Posts

6 July 2009 at 1:48pm

Hrm, I've never seen that error before, which is a bit weird. But here's how to fix it:

Change this line:

foreach($this->markedNodes as $id => $node) {

To this:

if($this->markedNodes) foreach($this->markedNodes as $id => $node) {

Avatar
KiwiJeff

Community Member, 2 Posts

6 July 2009 at 8:23pm

Thank you Sam for the suggestion.

After my post I discovered that it was the Forum module that was at fault, it was version o.1. I had included both the blog and forum modules in the initial install. So I reinstall SilverStripe without the Forum module and had no problems starting the CMS. I'll now download the latest version of the Blog and Forum and have a play. I am looking forward to seeing what I can develop.

Again thanks.