We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10405
    • 288 Posts
    Hi, having a real issue with a container resource that contains five pages in a submenu structure, as follows:

    Root menu -> (pages plus [container resource])-> 5 pages

    I created a resource alias for it, selected an appropriate template, and edited my menu to point to that alias, but for some reason it just goes to a page not found error when I browse to http://mysite.com/containerresource.html.

    Friendly URLs are turned on and working, all other resources are working. I've tried unpublishing and republishing the resource, to no avail.

    Surely it's possible to have a container resource which is also a visible site page in its own right? Anyone know what I need to do to achieve this?
      • 22303 MODX Staff
      • 10,725 Posts
      Containers in MODX have a special suffix for Content Types with text/html mime-types that is controlled by the Setting container_suffix. By default, the value of this is "/" so that it mimics the behavior of a folder on a typical web server, .e.g. navigating to containerresource without the slash would 301 to the version with the slash. So when a Resource is a Container, it will not get the Content Type extension, but rather the container_suffix.
        • 10405
        • 288 Posts
        Okay, thanks- so how do I fix the problem? How should I name the container resource so that it's also visible as a page on the site?
          • 22303 MODX Staff
          • 10,725 Posts
          Put a link to it, e.g. if the id of the Resource is 5:
          [[~5]]
          and it will show you the URL it is available at. In this case, unless you changed settings, it would be available as either:

          /containerresource
          /containerresource/

            • 10405
            • 288 Posts
            Ok, well I put this in the menu temporarily:

            <a href="[[~18]]">Link</a>

            And it went to http://mysite.com/container-resource/

            The problem is, unlike the other resources it isn't seeing the global stylesheets- it's displaying raw content but that's it. I want it to use the same template as the related pages- don't really want to mess about with custom relative paths to the CSS. Really need a way of fixing this.
              • 10405
              • 288 Posts
              That should say [ [ ~18 ] ] in the link by the way. The forum stripped the tag for some reason.
                • 10405
                • 288 Posts
                Anyone know what I can do about this? Even if I edit the template so that it points to ../style.css instead of style.css, the resource still isn't getting any fo the formatting... huh
                  • 10405
                  • 288 Posts
                  Might the problem be because the container resource is actually located inside another container resource? I deliberately set it up this way in order to try and exactly mirror the menu structure so that the content managers see a familiar "tree" when they access the backend.

                  Surely there has to be a way of solving this?
                    • 3749
                    • 24,544 Posts
                    Try using the full URL in the reference to the CSS file in the template.
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting