We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 35176
    • 193 Posts
    In Chunk editor, above the content editor, display list of all objects that currently use this Chunk. Could also be done with Templates, snippets, TV’s, and other objects.

    I would LOVE this, and i think it would be a huge aid to developers
      jealousy<>love
    • Hmm, just thinking about the technical side here..
      That’d mean doing a full text search on every resource content, other resource fields and all TV values. Looking through snippets for $modx->getChunk(’chunkname’). Looking through TV input options.

      Besides that it will take a long time to search all that even on a small site, there’s no way to get all the references to chunks. You’d probably need to account for [[$chunk? &inputoption=`value`]] too. And what if you have TV set up which has the names of chunks as values, which you call as [[$[[*tvname]]]] ? Complicating things there again..

      It would be easier to find resources using a template (in a snippet:
      $tpl = $modx->getObject('modTemplate',$tplname); $ress = $tpl->getMany('Resources');
      (may be Resource in the last call, unsure of exact atm) - and then making that output with a plugin.


      But here’s a question: do you really want to view the hundreds of resources using your "News" template next year? What’s the benefit in that?

        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 6228
        • 249 Posts
        +1 for this request, at least as a package add-on.

        Sure it would take many seconds to do a full text search in tables and fields of the MODx database, but the alternative is a visual inspection of all resources and elements which, in retrospect, would take a lot longer.
          lo9on.com

          MODx Evolution/Revolution | Remote Desktop Training | Development
          • 35176
          • 193 Posts
          i think searching could be avoided. each time an object is saved that uses the chunk, the reference would be stored in the property table of the referenced object, in a new property called "ReferencedBy". then, whenever the referenced object is brought up in the editor, displaying the objects that reference it would be instantaneous.

          (we’re using a database, might as well exploit it. now i’m starting to see the advantage of a db-based system vs a file-based system.)

          the modx manager would also have to do the reverse-- automatically delete items from the "ReferencedBy" field whenever a referencing object stops referencing it. perhaps one way to facilitate that would be a new "References" property on the referencing object, listing all the objects it references. If we display that the field-section of the referencing object, then that gives us two-way quick visibility of references in both directions.

          mark, you have hundreds of resources referencing the same chunk? you mean, you’re manually typing the same chunk into hundreds of objects? i’m still a newbie, but i think that the purpose of modx is to eliminate all that repetitive effort. i wonder if you might have any opportunities for templating.

          i’m not interested in the 10’s or hundreds of webpages where the widget appears, i just want to see the modx objects that explicitly reference the object with a tag.
            jealousy<>love
            • 35176
            • 193 Posts
            the modx manager would also have to do the reverse-- automatically delete items from the "ReferencedBy" field whenever a referencing object stops referencing it.

            perhaps one way to facilitate that would be a new "References" property on the referencing object, listing all the objects it references. If we display that in the field-section of the referencing object, then that gives us two-way quick visibility of references in both directions.

            each object in the lists ("Objects Referenced" and "Referenced By") would be links, which open object in the editor, or Quick Editor. Perhaps even scrolled to the first instance of the tag, with all other instances highlighted.
              jealousy<>love
            • Quote from: johnywhy at May 08, 2011, 04:03 PM

              mark, you have hundreds of resources referencing the same chunk? you mean, you’re manually typing the same chunk into hundreds of objects? i’m still a newbie, but i think that the purpose of modx is to eliminate all that repetitive effort. i wonder if you might have any opportunities for templating.

              I said hundreds of resources using a certain template (also an object, right?) - although the example of using a TV to select a chunk would indeed end up having many hundreds of references eventually.. wink

              Perhaps a CMP would be a better solution which you can tell to search for references at a certain point and sort, filter etc.
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                • 35176
                • 193 Posts
                If it’s that many, then wouldn’t storing that list in a property on the referenced object be considerably faster than searching?

                It could be a drop down list.
                  jealousy<>love