We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42393
    • 143 Posts
    If we change the name of an asset like a chunk, then any other assets that refer to that will of course no longer be able to find that renamed asset. I've seen comments on this and one suggestion was to do a global change in the database. OK, I can do that, but that's not very elegant. Is there an plugin or other manager mechanism that allows global text changes through all assets and resources?

    Here is one bit of wisdom I believe I've gained here, which I use in other environments. Because of the occasional need to do global changes, it's seems very helpful to use asset names with completely unique values. The consequence for using an asset name like 'footer' is that you won't be able to do a database change with that name - you'll zap a lot of things you don't want to.

    For example, you could use names that are prefixed with a site ID - so if the company is Foo's Bars, then use names like foo_header and foo_copyright. The problem with this is that if the company name changes, and that Does happen, the prefix will now be dated. Another issue is that if you want to clone the site and use it as a base for another site, the company name prefixes will be invalid.

    Someone might suggest that changing assets in the database should be done using the tag prefix, so do a global from *before to *after, then +before to +after, etc. From what I understand now, that's subject to problems as well.

    Perhaps it's better to tag names with an indicator of the asset type: tv_, tpl_, chk_, snp_, etc
    I think I'm gravitating to this for the reasons above. Addons all have a mix of "standards" in this area: JSONDerulo uses "FeedItem" as a suffix for all chunks. Those are unique and easy to find and identify. Login uses the prefix 'lgn' for everything. But AdvSearch doesn't have any standard - site admins need to be careful not to create conflicting asset names for this addon and others.

    It would be nice if we could refer to tags by convention using their category as a namespace, so [[*mycorp.header]]. That ID is easy to find and change globally if required, and there's no question about where to find that asset. I have a twitter feed on my home page using JSONDerulo, and my related chunks are under Chunks\MyCompany\Twitter - I wish I could refer to those chunks with a syntax like this [[$MyCompany.Twitter.ChunkName]]. That would be very easy for code to find and modify if the asset name changed.

    So, um ... what's conventional wisdom on this?
    Thanks!
      Loved ModX when I was using it a few years ago. Shifted to WordPress, sorry. Thanks, all.
    • I tend to base my element name prefixes on the template name. But then on my site I'll end up with a lot of templates, with their accompanying elements that need to be unique to each template.
        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