We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17667
    • 108 Posts
    I want to set up a custom dashboard widget in MODX 2.2. I have an HTML file in my template folder.

    I set Widget type to "file" and for Widget Content I entered:
    [[+assets_path]]templates/custom/dashboard/shortcuts.html


    When I do this I get an error:
    Fatal error: Call to a member function setNamespace() on a non-object…

    What is the proper method for specifying a path for a file type dashboard widget?
      • 28215
      • 4,149 Posts
      1. Did you specify a different namespace for the Widget?
      2. Just straight-html widgets as File type widgets aren't supported yet. They will be in 2.2.1, as of this commit: https://github.com/modxcms/revolution/commit/a74d7e43575bf0a8224636ef16d28b96c3fa7673 For now, though, you have to use a PHP file that "return"s the output.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 17667
        • 108 Posts
        I left the namespace as the default that comes up, Core. Good to know that it has to be PHP for now.

        So I changed the path to a test PHP file and still get the error. The PHP just has a simple echo statement. I think I still have not input the proper path to the file. Do I need to change the namespace?

        I tried:
        [[+assets_path]]templates/custom/dashboard/test.php


        and
        /assets/templates/custom/dashboard/test.php
          • 28215
          • 4,149 Posts
          You can leave the +assets_path placeholder in. That's fine.

          Are you sure the file exists there? This works fine on my environment I just tested.
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 17667
            • 108 Posts
            The file path is definitely correct. Using 2.2.0 pl2. I tried switching to other namespaces but no luck.