We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20853
    • 14 Posts
    I’ve had a look in JIRA and a thorough search of the forum;
    But this is my first bug and it seems so obvious I can’t believe I’m the first to report it; I must be missing something huh
    Tell me to stick it in JIRA and I’ll so do smiley

    I’ve got two websites running v2.0.0 RC2
    One running locally on a WAMP stack with PHP 5.3.0 and MySQL 5.0.88
    One running hosted with PHP 5.2.13 and MySQL 5.0.90-log
    Both show the same problem.

    The problem is that the isfolder column in the modx_site_content table has incorrect values in it.
    For example, the row for the home page has ’1’; this page does not have children and has never had children.
    There are other examples where it should be ’1’ and is actually set to ’0’.
    The problem is not restricted to top-level resources.
    You can see this illustrated at http://www.priddysomerset.org/ - the dropdown menus are working perfectly, but the dropdown indicators are incorrect.

    I originally thought it was a Wayfinder bug, but some debugging showed that Wayfinder is only displaying the information it is provided about each resource.
    So I waded into the MySQL console and inspected the database table content which confirms that Wayfinder is getting the data held in the database.
    It is the database content that is incorrect.

    Note: The Manager interface shows the correct resource icon; so presumably it is being set by the number of children rather than the isfolder attribute.
      • 20853
      • 14 Posts
      Just a thought - it looks straightforward to modify Wayfinder to work out whether the resource is a parent using the count of displayed documents rather than resource property.
      This would also fix a number of long-standing bugs I found on the Wayfinder forum regarding hidden resources.

      Let me know if you’d like me to go ahead and prototype the code change so you can decide whether to adopt it.
      Duncan
        • 3749
        • 24,544 Posts
        As you’ve discovered, in Revolution, isfolder is independent of whether the resource has children or not. You can change it with the "Container" checkbox on the Page Settings tab.

        In Evolution, it was automatically set to true on save if there were children. This is no longer true.

        IOW:

        isfolder is based on the Page setting, nothing else.

        Whether a document actually has children can be determined with its hasChildren() method.


        <?php
        if ($modx->resource->get('isfolder')) {
            $output .= "It's marked as a container</p>";
        }
        
        if ($modx->resource->hasChildren()) {
        
        $output .= "<p>This document has Children</p>";
        }
        
        return $output;
        ?>
        


        Marking a resource as a container (isfolder) will effect Friendly URLs and snippets like getResources.

          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
          • 20853
          • 14 Posts
          Woo - you are spot on!
          Thanks Bob

          I edited the problem resources and the Page Settings checkbox for Container was ’wrong’ in all cases.
          Flipping the flag makes the menu look correct.

          Maybe the default behaviour ought to be to maintain the flag so it reflects the resource hierarchy.
          I think the touchpoints should be resource CRUD plus drag/drop.
          In the occasional advanced cases the flag can be flipped so that it does not reflect the resource hierarchy.

          Something that definitely needs doing is the Wayfinder tweak I mentioned earlier.
          I.E. The class name set by &parentClass should only be applied if there are visible sub-pages.
          This will fix stacks of drop-down menu problems people are going to be hitting soon.
          Do you think this is reasonable?
          Would you like me to raise a JIRA ticket for it?
          Would you like me to prototype the change?

          Regards - Duncan
            • 3749
            • 24,544 Posts
            It sounds reasonable to me (not that that necessarily means anything). Feel free to file any suggestion that you think will be an improvement in Jira. Prototyping is always welcome. smiley

            I wonder if an extra parameter like &use_isfolder that would use isfolder if set and hasChildren() if not would be useful.

              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
              • 22303 MODX Staff
              • 10,725 Posts
              Quote from: Nacnud at Jun 08, 2010, 02:34 PM

              Maybe the default behaviour ought to be to maintain the flag so it reflects the resource hierarchy.
              I think the touchpoints should be resource CRUD plus drag/drop.
              In the occasional advanced cases the flag can be flipped so that it does not reflect the resource hierarchy.
              Do not agree at all. It is important that adding children or removing children does not change this setting or it will change your URL for the page and could screw up many things, like your page ranks, external links, etc.

              I think an option you could enable to have this happen could be added, but a warning should be provided if you enable that.

              Quote from: Nacnud at Jun 08, 2010, 02:34 PM

              Something that definitely needs doing is the Wayfinder tweak I mentioned earlier.
              I.E. The class name set by &parentClass should only be applied if there are visible sub-pages.
              This will fix stacks of drop-down menu problems people are going to be hitting soon.
              Do you think this is reasonable?
              Would you like me to raise a JIRA ticket for it?
              Would you like me to prototype the change?
              I think Wayfinder should be modified to use the presence or absence of children as needed rather than isfolder if that’s what the problem is.
                • 3749
                • 24,544 Posts
                Quote from: OpenGeek at Jun 09, 2010, 01:48 PM

                I think Wayfinder should be modified to use the presence or absence of children as needed rather than isfolder if that’s what the problem is.

                That’s sort of what I was suggesting here, except that I’m suggesting it be configurable through a parameter (with the default behavior as you suggest):

                I wonder if an extra parameter like &use_isfolder that would use isfolder if set and hasChildren() if not would be useful.
                  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