We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29076
    • 615 Posts
    Yes, I saw that in the code and tried that, but with the same result. I’ll look at it in the morning. smiley
      I think, thererfor I am! But what I am, and why...?
      • 15667
      • 11 Posts
      I’d like to count the number of children that have "Show in menu" checked. I can think of two ways to do this:

      1. get the child ids for the container and iterate through them to see how many have "Show in menu" checked.
      2. write a SQL select statement with a ’WHERE hidemenu=0’ clause.

      #1 would seem to be the cleaner approach but I’m wondering if there is a performance penalty. Perhaps there is a better way?
        • 5340
        • 1,624 Posts
        I would use 2. It’s simpler in my opinion.
        Let me know if you need help with that.
        • Quote from: kenw at Apr 10, 2009, 05:39 PM

          I’d like to count the number of children that have "Show in menu" checked. I can think of two ways to do this:

          1. get the child ids for the container and iterate through them to see how many have "Show in menu" checked.
          2. write a SQL select statement with a ’WHERE hidemenu=0’ clause.

          #1 would seem to be the cleaner approach but I’m wondering if there is a performance penalty. Perhaps there is a better way?
          3. get the childs ids for the container and use the API:
          <?php
          $childids = $modx->getChildIds($parentId);
          $modx->getDocuments($childids, 1, 0, "id,pagetitle,longtitle,introtext", 'hidemenu=0');
          ?>