We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36922
    • 26 Posts
    Hi there,
    I think this may be a simple question only can't quite see how to do it.
    I have a page that needs to appear in 3 different places on a site, exactly the same content, just sitting under 3 different main nav links. The SymLink option didn't work for this as the breadcrumbs didn't reflect where the duplicate page was sitting (actually it was a bit temperamental, sometimes it showed 'home > main nav link > duplicate page' and other times it would just show 'home > duplicate page'.
    So I've moved on to looking at getResouceField, only I want to duplicate all the contents of the page, so [[*content]] plus TVs. Can i use getPage for this? Or any other suggestions? Thanks very much.
      • 3749
      • 24,544 Posts
      I don't know of an easy way to do that without creating a custom snippet and a custom Tpl chunk. At that point, you might as well just duplicate the page twice.

      Breadcrumbs might behave better if you used Weblinks instead of Symlinks.
        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
        • 36922
        • 26 Posts
        Thanks Bob, you are a gem to help out so much. Will have a go at Weblinks, otherwise I can go with the way I've done it (templates with quite a few getResourceFields, just seemed a bit messy).
        Really appreciate it again.
          • 36922
          • 26 Posts
          Bob that did it!! Shizen I wish I posted earlier! thanks thanks thanks.
            • 36922
            • 26 Posts
            Acutally, just saw it doesn't keep the breadcrumbs as I'd like, it references the page that is being copied. Very close though.
              • 3749
              • 24,544 Posts
              The more I think about it, symlinks *should* do just what you want. Did you try calling Breadcrumbs uncached?

              [[!Breadcrumbs]]


              If you do end up doing it the hard way, creating the template as a Tpl chunk with placeholders and using getResources, specifying the ID of the real resource in the &resources property and the Tpl chunk in the &tpl property, might be easier.
                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
                • 36922
                • 26 Posts
                Hi there Bob,
                Just had a look and the breadcrumbs weren't/aren't uncached... will have a go and see how it goes, thanks!
                  • 36922
                  • 26 Posts
                  It does work with the uncached breadcrumbs Bob. i think I still might have to go the hard way though, as there are tvs in the template, and the values in them aren't copied across (unless I'm doing something wrong?). So within the page that i'm copying is a little table with 3 tabs, and each tab holds tv information. When I copy the page as a SymLink, I still have to set the tvs. I could use getResourcesField? &id=`21` &field=`tab1`, only I don't think I could expect the folks on the receiving end to be able to do that when they need to duplicate a page. I've ended up setting up a 'product copy' template, so the only tv they have to set is the id of the page they're copying, and that fills in all the relevant tv bits. Does that make sense? Am i making things more difficult than they need to be?
                    • 3749
                    • 24,544 Posts
                    When you say you have to "set the TVs", do you mean that you have to set the value of the TV for each Symlink? Would it help to set the default value of the TV? You can also use Form Customization to set the default value of the TV for any specific page.

                    Is there a way you could move the TVs from the template to the page's resource content field? That might solve your problem.
                      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
                      • 36922
                      • 26 Posts
                      i think you're right only i'm just not cluey enough!
                      the example is at http://lavaworks-testsite.com.au/uci/index.php?id=108, you'll see that the same page sits at http://lavaworks-testsite.com.au/uci/index.php?id=109. so there is the '[[*content]] bit, then there is a table (built into the template), which has 3 template variables (tab1, tab2, and tab3).
                      so if i used the symlink option, it copies the page, plus the [[*content]] section, plus the table, only not the info from the tvs. the template is called 'product_template' and is used for various products (so in this case it's 'Fixed Term Investments', only it's also used for 'Money Manager' (http://lavaworks-testsite.com.au/uci/index.php?id=110) and others, so i don't think default tv values would work...?
                      it has ended up that I've created a template called 'product_duplicate' where the only template variable they have to enter a value in is the id of the page they are copying, and this uses getResourceField to fill in the tabs. it only seems like it should be easy enough for the client to do. Symlink would still be awesome as i could do away with a template, only not sure how to get the table of tabs to be included as part of the [[*content]].
                      thanks again for your reply Bob.