We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4673
    • 577 Posts
    Ok, please explain this to me.

    why do folders act like a document even when there is no content in them?

    I would imagine that if no content exists a subcategory page would be shown AKA yahoo.

    IF I’m wrong or off the wall as usual please just tell.

    hehe, I have a feeling Ryan will be cruising by any moment. laugh
      Tangent-Warrior smiley
    • It’s not that folders are acting like documents, it’s that documents can act as folders. It’s all virtual.

      The only difference is that the is_folder field is set, and that’s only important in drawing the Document Tree (folders get the cute little folder icon). An "empty" document can serve quite nicely as a container; for example I have the following virtual structure set up for an "Our People" section that uses the FAQ snippet:

      Our People (folder, published, has some text and the FAQ snippet called twice on it)
      -----> Producers (folder, unpublished, empty)
      -----> Person One
      -----> Person Two
      -----> etc etc
      -----> Administrators (folder, unpublished, empty)
      -----> Admin One
      -----> Admin Two
      -----> etc etc

      Anyway, if you want an empty "folder" to devolve to a child in your site’s menu, it’s easy enough to make a menu snippet to do that. "if (content == ’’) { query for docs with id as parent, and make their id(s) the link(s) instead }, although that would get a little convoluted when looping for multi-level menu.

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 1764
        • 680 Posts
        Quote from: sottwell at Sep 21, 2005, 11:03 AM

        Anyway, if you want an empty "folder" to devolve to a child in your site’s menu, it’s easy enough to make a menu snippet to do that. "if (content == ’’) { query for docs with id as parent, and make their id(s) the link(s) instead }, although that would get a little convoluted when looping for multi-level menu.

        One other way to do this would be to create a custom template with no content (when we get to the point where content becomes a TV) and have a TV where you can specify a "index page" for the folder. The template could be nothing but a meta refresh to whatever the index page is. I think that a lot of people don’t actually want to have a folder page so this might be something good to add as another default template.

        A slightly different route would be to create a plugin that would check your content. If none existed, and it was a folder then it could automatically create an index of the subpages. If no content existed but the document was not a folder it could automatically generate a coming soon message. This is something that might be nice to have for some of my clients so I might work on this myself and release it back out to the community.
          • 7455
          • 2,204 Posts
          in an olther version of mod x when creating a folder without content it would return a "#" as link that way the folder would colaps but no page will be loaded the only problem whit that was if you wanted to add content to that folder late that the link would still be "#"
          if there was a slectionbox to select if you want to show the content of the folder or just colaps and stay on the pressent page by using "#"as a link.

          Take a look at my treat from months ago about this feature:

          http://modxcms.com/forums/index.php/topic,619.0.html

          greets Dimmy
            follow me on twitter: @dimmy01