Jump to:

23355 Posts in 17734 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » Cannot access Admin - dev/build and possibly others.

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2
Go to End
Author Topic: 1775 Views
  • KaDMiO
    Avatar
    Community Member
    5 Posts

    Cannot access Admin - dev/build and possibly others. Link to this post

    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!

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: Cannot access Admin - dev/build and possibly others. Link to this post

    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.

  • KaDMiO
    Avatar
    Community Member
    5 Posts

    Re: Cannot access Admin - dev/build and possibly others. Link to this post

    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.

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: Cannot access Admin - dev/build and possibly others. Link to this post

    Looks fine to me, although I've never used it, what was the errror?

  • KaDMiO
    Avatar
    Community Member
    5 Posts

    Re: Cannot access Admin - dev/build and possibly others. Link to this post

    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.php

    MySQLDatabase->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.php

    MySQLDatabase->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.php

    DB::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.php

    SQLQuery->execute()
    Line 2736 of DataObject.php

    DataObject->instance_get(ParentID = ,,,,DataObjectSet)
    Line 2714 of DataObject.php

    DataObject::get(Widget,ParentID = )
    Line 12 of Page.php

    Page->IHaveWidgets()

    call_user_func_array(Array,Array)
    Line 693 of Object.php

  • KaDMiO
    Avatar
    Community Member
    5 Posts

    Re: Cannot access Admin - dev/build and possibly others. Link to this post

    The error was triggered by trying to access the admin page.

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: Cannot access Admin - dev/build and possibly others. Link to this post

    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;
    }

  • KaDMiO
    Avatar
    Community Member
    5 Posts

    Re: Cannot access Admin - dev/build and possibly others. Link to this post

    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.

    1775 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.