21294 Posts in 5734 Topics by 2602 members
| Go to End | Next > | |
| Author | Topic: | 1210 Views |
-
Cannot access Admin - dev/build and possibly others.

29 July 2011 at 1:57pm
Hi all!
Even though it is the first time I use SilverStripe, I've found it very useful, keep up the good work!
The problem I am having is that I cannot access either the admin page nor any of the dev pages. I admit I have been tinkering with the code, but nothing related to the part that handles paths. flush=all won't work either.
The page I always land on says:
Server error
Sorry, there was a problem with handling your request.I don't really know what to do, any help is appreciated. Whatever you need, just ask me.
Thanks!
-
Re: Cannot access Admin - dev/build and possibly others.

29 July 2011 at 9:22pm
Hi KaDMiO,
Welcome to Silverstripe!
The server error can be turned into something more meaningful, please checkout http://www.silverstripe.org/general-questions/show/16055 for turning on dev mode.
-
Re: Cannot access Admin - dev/build and possibly others.

29 July 2011 at 11:27pm
Thanks a lot about that!
It seemed that a function I had added to page.php was triggering the problem. By removing it I was able to solve this issue, but now I have another one. I need a way of knowing if a certain page has or has not a Sidebar with widgets in it. The code I had added was the following:
I have found it in another post of the forum.
function IHaveWidgets () {
return DataObject::get("Widget", "ParentID = $this->SidebarID");
}Do you know a way I can do the same without breaking the installation?
Again, thanks for the superquick answer.
-
Re: Cannot access Admin - dev/build and possibly others.

29 July 2011 at 11:32pm
Looks fine to me, although I've never used it, what was the errror?
-
Re: Cannot access Admin - dev/build and possibly others.

29 July 2011 at 11:43pm
This is the specific error.
[User Error] Couldn't run query: SELECT "Widget"."ClassName", "Widget"."Created", "Widget"."LastEdited", "Widget"."Sort", "Widget"."Enabled", "Widget"."ParentID", "PageContentWidget"."WidgetTitle", "PageContentWidget"."PageID", "Widget"."ID", CASE WHEN "Widget"."ClassName" IS NOT NULL THEN "Widget"."ClassName" ELSE 'Widget' END AS "RecordClassName" FROM "Widget" LEFT JOIN "PageContentWidget" ON "PageContentWidget"."ID" = "Widget"."ID" WHERE (ParentID = ) ORDER BY "Sort" You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY "Sort"' at line 1
This is the trace:
Trace
Couldn't run query: SELECT "Widget"."ClassName", "Widget"."Created", "Widget"."LastEdited", "Widget"."Sort", "Widget"."Enabled", "Widget"."ParentID", "PageContentWidget"."WidgetTitle", "PageContentWidget"."PageID", "Widget"."ID", CASE WHEN "Widget"."ClassName" IS NOT NULL THEN "Widget"."ClassName" ELSE 'Widget' END AS "RecordClassName" FROM "Widget" LEFT JOIN "PageContentWidget" ON "PageContentWidget"."ID" = "Widget"."ID" WHERE (ParentID = ) ORDER BY "Sort" You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY "Sort"' at line 1
Line 525 of MySQLDatabase.phpMySQLDatabase->databaseError(Couldn't run query: SELECT "Widget"."ClassName", "Widget"."Created", "Widget"."LastEdited", "Widget"."Sort", "Widget"."Enabled", "Widget"."ParentID", "PageContentWidget"."WidgetTitle", "PageContentWidget"."PageID", "Widget"."ID", CASE WHEN "Widget"."ClassName" IS NOT NULL THEN "Widget"."ClassName" ELSE 'Widget' END AS "RecordClassName" FROM "Widget" LEFT JOIN "PageContentWidget" ON "PageContentWidget"."ID" = "Widget"."ID" WHERE (ParentID = ) ORDER BY "Sort" | You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY "Sort"' at line 1,256)
Line 123 of MySQLDatabase.phpMySQLDatabase->query(SELECT "Widget"."ClassName", "Widget"."Created", "Widget"."LastEdited", "Widget"."Sort", "Widget"."Enabled", "Widget"."ParentID", "PageContentWidget"."WidgetTitle", "PageContentWidget"."PageID", "Widget"."ID", CASE WHEN "Widget"."ClassName" IS NOT NULL THEN "Widget"."ClassName" ELSE 'Widget' END AS "RecordClassName" FROM "Widget" LEFT JOIN "PageContentWidget" ON "PageContentWidget"."ID" = "Widget"."ID" WHERE (ParentID = ) ORDER BY "Sort",256)
Line 129 of DB.phpDB::query(SELECT "Widget"."ClassName", "Widget"."Created", "Widget"."LastEdited", "Widget"."Sort", "Widget"."Enabled", "Widget"."ParentID", "PageContentWidget"."WidgetTitle", "PageContentWidget"."PageID", "Widget"."ID", CASE WHEN "Widget"."ClassName" IS NOT NULL THEN "Widget"."ClassName" ELSE 'Widget' END AS "RecordClassName" FROM "Widget" LEFT JOIN "PageContentWidget" ON "PageContentWidget"."ID" = "Widget"."ID" WHERE (ParentID = ) ORDER BY "Sort",256)
Line 400 of SQLQuery.phpSQLQuery->execute()
Line 2736 of DataObject.phpDataObject->instance_get(ParentID = ,,,,DataObjectSet)
Line 2714 of DataObject.phpDataObject::get(Widget,ParentID = )
Line 12 of Page.phpPage->IHaveWidgets()
call_user_func_array(Array,Array)
Line 693 of Object.php -
Re: Cannot access Admin - dev/build and possibly others.

29 July 2011 at 11:44pm
The error was triggered by trying to access the admin page.
-
Re: Cannot access Admin - dev/build and possibly others.

30 July 2011 at 12:00am
Sounds like you don't have...
class Page extends SiteTree {
...
public static $has_one = array(
"SideBar" => "WidgetArea",
);
...but you could wrap it with this to ensure it doesn't error in that case...
function IHaveWidgets () {
if (is_numeric($this->SidebarID)) {
return DataObject::get("Widget", "ParentID = $this->SidebarID");
}
return null;
} -
Re: Cannot access Admin - dev/build and possibly others.

30 July 2011 at 8:53am
Thanks a lot! That did it!
Page.php does have the WidgetArea enabled, I think the problem was that one of the Admin sites does inherit from Page.php, but has the $has_one variable defined differently, without the WidgetArea.
| 1210 Views | ||
| Go to Top | Next > |


