We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7293
    • 12 Posts
    Hello everyone,

    My company is struggling to completely renovate some of our current websites using a managed solution. We were going to use Silverstripe, but then I found MODx this morning. I’m really impressed with some of its features so far - and am hoping someone can give me a quick hint about implementing a major concern of ours. I hate posting these questions, because the information probably exists, but I’ve been combing the docs and the forums and am worried I’m going to make an assumption of feature like I did with Silverstripe to be surprised later on.

    We would like to re-use a lot of content through our site, without needing to constantly duplicate it. We’ll want to do it this way basically:

    Have two or three (or four or five or 100) ’Sections’ of the website depending on the type of visitor (Consumer, Professional, Customer of an Affiliate). However, a lot of the actual content will be the same between these ’sections’, differing in the navigation (page tree) and the overall look of the page (which is really just header and sidebar changes and I’m guessing could easily be taken care of with different templates or chunks). However, we want to use the actual content (and template variables) in multiple places. Something like this:

    +Consumer (1)
    -+Products (2)
    ---product one (3)
    ---product two (4)
    ---product three (5)
    -+Benefits (6)
    ---benefits of product one (7)
    ---benefits of product two (8 )
    ...
    +Professional (9)
    -+Products(same as #2 with different sidebar)
    ---product one (same as #3)
    ...

    It would be like using symbolic links, except I want the URL and navigation to stay in the correct section, such that
    www.mysite.com/consumer/product1 & www.mysite.com/professional/product1 display the same content but with different nav and sidebars.

    I’ve spent hours reading documentation and it looks like this SHOULD be possible, I just can’t seem to put my finger on how. Can someone give me a realistic assessment and maybe point me in the right direction?

    Thanks!

    Daniel
      • 3749
      • 24,544 Posts
      Interesting question. Maybe someone else has an easier solution, but the Wayfinder snippet, which generates MODx menus, takes its data from the actual document tree of the site so the only way to do it (without writing custom PHP code) that I can think of would be as follows:

      Create a template for your home page and a template for each user group (e.g. customers, professionals, etc.).

      Create a master home page (using the home page template) and put secondary home pages under that (e.g. customer, professional, etc.) with each based on the appropriate template. Each document directly below the master home page would then be the home page for one group.

      Create a separate version of the site as pages below each one of those second-level home pages.

      In the Wayfinder call in each template, set the &startId parameter to the id of the appropriate second-level home page. The one on the master home page would probably only go to &level=`1` (showing just the secondary home pages).

      Put all your reusable content in well-named chunks and put {{chunkname}} in the documents where you want them to appear.

      Any reusable material in the templates (e.g. common header and footer stuff) can also be placed in chunks to cut down on bloat and make maintenance easier.


      Bob

        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
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Using the Friendly URL Paths (or whatever it’s called) and allowing duplicate aliases you can have pages with the same alias in different sections.

        You can use TVs and the @DOCUMENT binding to have the same content in different pages. Keep in mind the distinction between a MODx document and the final web page. What is in the MODx document is what is displayed using the [*content*] tag. The same thing is produced with a TV and @DOCUMENT binding. A template does not have to have a [*content*] tag. It can have a [*customTV*] tag, or just snippet or chunk tags.
          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
          • 7293
          • 12 Posts
          Thank you both for the quick replies. I am going to experiment with the combination of your answers right now.
            • 7293
            • 12 Posts
            After some play-time, I’ve got the basics of the using TVs and Chunks to control the sidebar and header. I was even able to create a Virtual Page template that pulls [*content*] from another page.

            Now, I have a new question:

            I plan to make fair use of TV’s to build structured pages - ie, we want to enforce consistency in design, so we’ll have a Template with 2 content blocks and 3 images and use TV’s to force the designer to setup each one (unless this is a really bad idea.. ). Is there a way to deal with this similar to using @DOCUMENT? The ideal result would be a way to grab each TV and display it on the ’Virtual’ page. Are there other ways to go about this that anyone can suggest? I’m willing to experiment and read docs, but I’m at a loss as to where to start on these issues (and I’m under some time-constraints to confirm or deny that MODx will work for us).

            Thanks again!

            Daniel
              • 17851
              • 213 Posts
              Daniel
              I think you’re onto the basic idea. Using TV’s you’d pull in content from any document you want. In your example, you’d have a master list of products, but in Consumer Products, your Product One page would have a TV that pointed to the original (or master) Product One via @DOCUMENT. So you wouldn’t actually use the content area of Consumer Product One, just the TV. Is that what you’re trying now?
                Mark Macatee
                President
                Power 10 Solutions
                http://www.power10solutions.com
                • 7293
                • 12 Posts
                Quote from: MacLonghorn at Oct 01, 2007, 10:02 AM

                Daniel
                I think you’re onto the basic idea. Using TV’s you’d pull in content from any document you want. In your example, you’d have a master list of products, but in Consumer Products, your Product One page would have a TV that pointed to the original (or master) Product One via @DOCUMENT. So you wouldn’t actually use the content area of Consumer Product One, just the TV. Is that what you’re trying now?

                I think that’s what I’m trying to do smiley I’m lost in one thing - how do I pull in the TV content from another page? For example, if I have:

                +Master Product List (1)
                --Product One (2)
                +Consumer (3)
                --Product One (4)

                And Product One (2) contains not only content but a few user-defined TVs (prodimage1,prodimage2,cart_link), then in Product One (4), how do I pull in those TVs to display?

                Thanks,

                Daniel
                  • 17851
                  • 213 Posts
                  ahhh, not sure about that one.
                    Mark Macatee
                    President
                    Power 10 Solutions
                    http://www.power10solutions.com
                    • 11975
                    • 2,542 Posts
                    Hi

                    the easiest way is to use Ditto with &documents=`2`

                    :-)
                      Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                      • 29181
                      • 480 Posts
                      As with all things MODx, there are lots of ways to do most things. As heliotrope says Ditto is probably the easiest, but sometimes I prefer to use:

                      http://wiki.modxcms.com/index.php/API:getTemplateVarOutput

                      Sometimes Ditto is just pure overkill imo.

                      Either way, good luck & I hope you can persuade your superiors to go with MODx, it sounds like a very interesting project indeed.

                      Taff
                        Adrian Lawley: www.adrianlawley.com