We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53746
    • 9 Posts
    Hi, I'm a beginner in Modx. Just inherited a modx website from another developer. I need to make a few modifications. The previous developer has a chunk with this kind of code in it:

     
    <li>test: [[+html.1.some_name]] [[+some_name]]</li>
    <li>[[+excess_amount]]</li>
    <li>[[+location]]</li>
    <li>[[+limit]]</li>
    


    Where do I find/configure the values in [[+]]?
    And
    Is [[+one.example]] is the dot "." referring to something specific from "one" or is it because the whole thing is called "one.example"?

    Thanks!
      • 17301
      • 932 Posts
      They're most likely coming from tv values associated with the resource it's pulling in from. So if for example there is a getresources call using this chunk then there will be a declaration in that call referring to either parents or resource ID.

      If you navigate to that resource ID then you can click on template variables tab and hopefully find the values there.

      Alternatively they could also be placeholders from an extra or snippet. [ed. note: lkfranklin last edited this post 9 years, 1 month ago.]
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 3749
        • 24,544 Posts
        The dots are most likely just part of the name of the placeholder.

        To expand on LK's answer, those are placeholder tags and the chunk is what we call a Tpl chunk.

        Some snippet (or, less likely, a plugin) sets those values as placeholders in a PHP array and calls something like $modx->getChunk('chunk_name', $fields); (where chunk_name is the name of that chunk. getChunk() replaces those placeholders with the values held in the $fields variable. The snippet would then return the chunk, with the values replaced, for display on the page.

        Based on the names of the placeholders, I'd guess it is a custom snippet. I could be wrong.

        First, look for a MODX tag [[ ... ]] in the resource displaying those values that has &tpl=`` where the part between the back-ticks is the name of that chunk. The part right after the [[ will be the name of the snippet that does the replacements.
          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
          • 53746
          • 9 Posts
          Quote from: BobRay at Sep 07, 2017, 04:01 PM
          The dots are most likely just part of the name of the placeholder.

          To expand on LK's answer, those are placeholder tags and the chunk is what we call a Tpl chunk.

          Some snippet (or, less likely, a plugin) sets those values as placeholders in a PHP array and calls something like $modx->getChunk('chunk_name', $fields); (where chunk_name is the name of that chunk. getChunk() replaces those placeholders with the values held in the $fields variable. The snippet would then return the chunk, with the values replaced, for display on the page.

          Based on the names of the placeholders, I'd guess it is a custom snippet. I could be wrong.

          First, look for a MODX tag [[ ... ]] in the resource displaying those values that has &tpl=`` where the part between the back-ticks is the name of that chunk. The part right after the [[ will be the name of the snippet that does the replacements.

          Is there anyway to find the name of the snippet/plugin with the values of these placeholders? Or there's no other choice than to go through them 1 by 1?
            • 3749
            • 24,544 Posts
            I'm afraid there's no simple way, unless you can ask the programmer. As I said, it's much more likely to be a snippet than a plugin. When you edit the snippet, you can use the browser's search function to look for the name of the placeholder.

            If you're good at MySQL, you could construct a query in PhpMyAdmin to look for for the placeholder name in the 'snippet' field of the snippets and the 'plugincode' field of plugins.

            Here's another way to go that I think should work. Create a new snippet called FindPlaceholder with this code:

            /* Find Placeholder snippet */
            $ph = $modx->getOption('placeholder', $scriptProperties);
            
            $output = '<h3>Searching Snippets</h3>';
            
            if (!empty($ph)) {
            
                $snippets = $modx->getCollection('modSnippet');
                foreach ($snippets as $snippet) {
                    $content = $snippet->get('snippet');
                    if (strpos($content, $ph) !== false) {
                       $output .= '<p>snippet ' . $snippet->get('name') . ' contains placeholder ' . $ph . '</p>';
                    }
                }
            } else {
               return '<p>Error: Placeholder property is empty</p>';
            }
            
            $output = '<h3>Searching Plugins</h3>';
            
            if (!empty($ph)) {
            
                $plugins = $modx->getCollection('modPlugin');
                foreach ($plugins as $plugin) {
                    $content = $plugin->get('plugincode');
                    if (strpos($content, $ph) !== false) {
                       $output .= '<p>Plugin ' . $plugin->get('name') . ' contains placeholder ' . $ph . '</p>';
                    }
                }
            }
            
            return $output;



            Then create a resource called Search with this code in the Resource Content field:

            <h2>Placeholder Search</h2>
            
            [[!FindPlaceholder? &placeholder=`placeholdername`]]


            Replace 'placeholdername' with the name of an actual placeholder (just the alphanumeric part, no tags or tokens).

            Save the resource, then click on "View" at the upper right to look at it in the browser. It should report any snippets or plugins holding that placeholder.

            You can replace the placeholdername, "Save," and "View" to see other placeholders, but I suspect that they'll all be in the same snippet or plugin.

            One catch is that if the snippet or plugin loads a class file and the placeholder is set in the class file, it may not appear in the snippet itself, but it shouldn't take long to find out if the FindPlaceholder snippet is failing. It's possible to alter the snippet to handle this, but let's hope it's not necessary.

            [Update] Another thought. The placeholders look like they might be part of an eCommerce package, so if there is one, they would probably be set in one of its snippets or a class file loaded in one of them.
              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