We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I’m all for the doctree api addition asap. Would be tremendously useful I’d think. What type of options should it have?
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 34162
      • 1 Posts
      I’m not the api specialist here but it would need for sure to be able to pull the whole doctree with one sql call. For options you may wnt to include depth for sure as well as parrent, subblings, and sub nodes. This api would be great for many other things also that now require a ton of work to get done. For instnce the most recent snippet.

      You may also want it set up so that you can select other variables as limits for instance keywords so that it only pulls those items with the same keywords.

      Right now I have quite a few of these types of snippets installed and instead of each one of them making multiple sql calls they could be done in a single sql call for each snippet.

      listmenu
      recent topics
      related keywords.
      atom feed
      rss feed
      listsitemap
      googlemap


      I looked jsut out of curiousity and the listsitemap on my site right now and to load that page takes 44 sql calls. as my site gets bigger that is only going
      to go up without a good api in place t ocover these types of things. It would also seem that the way modx and ent hadnle documents that this will be a real barier to getting the site to scale when it gets to having a few hundred pages. As soon as I get a pretty good number of themes finshed up my site will be eating the database for lunch.
      • I have several sites with 100+ pages and so far; no problem scaling at all. And in reality, most of the time, I cache the menu until I make a change to the site structure. So this isn’t really an issue in most cases, but I agree we need some more robust API calls for those situations where the very dynamic menu is important. However, in cases of huge sites, pulling down one large map isn’t efficient either. May reduce traffic, but increases memory and processor usage. There’s always a fine balance between the two, and adding the API’s for this will simply give you the power to choose; which is what we like! cool
          • 34162
          • 1 Posts
          I undersstand completely about memory usage. I was not refering to a way to pull the whole tree into memeory at once. Rather I htinking of a more robust way to gather data from the database. Yes caching does help some but has other drawbacks as well depending one the content of the site and weather or not the site is interactive. I guess one solution would be to only cache the menu itself and not the pages.

          At any rate if the sql was structured properly each of these snippets listed above could be done with 1 sql instead of 1 sql call per link. This way is not pulling a hiuge array into memory but rather only what is needed and furrthermore it lessens the database load. The best of both worlds.
            • 4673
            • 577 Posts
            couldn’t this help?

            http://vertexworks.com/forums/index.php?topic=401.0

            seems to be a robust way to transverse the tree category ... could be wrong too smiley
              Tangent-Warrior smiley