We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52804
    • 36 Posts
    I have set up a Symlink with the following getResources call in the target resource but it doesn't work because [[*id]] is fetching the Symlink ID and not the target resource ID. Is this normal behavior for a Symlink and how can I make it work?

    [[!getResources?  
    &parents=`[[*id]]`
    &tpl=`sku-table-led-tpl`  
    &limit=`100`  
    &sortbyTV=`InputPower`
    &sortdirTV=`ASC`
    &sortbyTVType=`integer`
    &includeTVs=`1`  
    &includeContent=`1`   
    &depth=`0`]]
    

    This question has been answered by robh76. See the first response.

      • 20413
      • 2,877 Posts
      Good thread on Symlinks (Copy and paste) https://forums.modx.com/index.php?action=thread&thread=31465&i=1

      You need to place the getResources call on the linked resource!?
        @hawproductions | http://mrhaw.com/

        Infograph: MODX Advanced Install in 7 steps:
        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
        • 52804
        • 36 Posts
        Quote from: mrhaw at Dec 13, 2016, 06:51 PM
        Good thread on Symlinks (Copy and paste) https://forums.modx.com/index.php?action=thread&thread=31465&i=1

        You need to place the getResources call on the linked resource!?

        Thanks, I did read the thread but still don't quite get it. My getResources call is in a template attached to the linked resource. The Symlink pulls in the body text etc. of the linked resource but not the GetResources because the ID is passed from the Symlink. I confirmed this by printing the [[*id]] in the linked resource.

        One further thing, I thought the Symlink would automatically use the same template as the linked resource but it doesn't. I have to attach a template to the Symlink other wise the content is plain text on a white page. If I use the same template as the linked resource everything looks good except GetResources doesn't return anything.

        Am I just missing something obvious here?
          • 3749
          • 24,544 Posts
          When using a Symlink, the template of the other page (the one that's being pulled in) is never used, so anything you put there will be ignored. It uses the current page's Template and URL and just pulls in the content.

          You can try putting the getResources tag in the 'content' field of the other resource. I don't think it will work, but it's worth a try.
            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
          • discuss.answer
            • 52804
            • 36 Posts
            Quote from: BobRay at Dec 14, 2016, 02:54 AM
            When using a Symlink, the template of the other page (the one that's being pulled in) is never used, so anything you put there will be ignored. It uses the current page's Template and URL and just pulls in the content.

            You can try putting the getResources tag in the 'content' field of the other resource. I don't think it will work, but it's worth a try.

            Thanks Bob... I think I've cracked it. As you say, everything gets overlayed from the Symlink onto the target page.. Template, [[*id]] [[*pagetitle]] etc.. The only things that don't get overlayed are template variables. However, I found two very useful system settings "symlink_merge_fields" and "forward_merge_excludes" - "symlink_merge_fields" is set to Yes by default. When set to "No", the target resource uses it's own template and variables. If it's set to "Yes" you can use "forward_merge_excludes" to enter a comma separated list of variables you want to exclude.
              • 3749
              • 24,544 Posts
              That's a great solution. I have to confess that I didn't know about those settings.

              Do you mind if I do a blog post on it?
                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
                • 52804
                • 36 Posts
                Quote from: BobRay at Dec 15, 2016, 04:58 AM
                That's a great solution. I have to confess that I didn't know about those settings.

                Do you mind if I do a blog post on it?

                No Problem. Please feel free...
                  • 3749
                  • 24,544 Posts
                  While working on the blog article, I discovered a little more about how TVs are handled with a Symlink. Actually, the TV values (along with most other fields) from the Symlink page will be used by default if they are not empty. If they're empty, the values from the target page will be used (even if the TV has a default value).

                  And, yes, TV names can be put in the forward_merge_excludes setting to make sure the values from the target page will be used if the symlink_merge_fields setting is set to "yes."
                    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