We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!

Answered One page site

    • 51020
    • 670 Posts
    I am building a one page site.
    Each section is its own resource, and each section has a very different template with multiple TVs.
    I thought I could use getresources to pull all the resources into the home page, but cannot work out how to being the complete resource and its template.

    Any ideas?

    Thanks!
    Andy

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

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I use two different methods of doing one-page sites, depending on how fixed the sections are.

      1. Have each section's HTML structure in the template, and use FastField (or pdoTools) to fetch the various fields and TVs of each section. This makes for a larger template, or you can break the sections out into separate chunks.

      2. Use getResources (or pdoResources) to load the sections, and have the content of the resource provide the HTML structure of each section. In this case I use a lot of TVs for section content, with Form Customization to control what editors see and don't see. Admin users can see the Content field to adjust the section structure, while Editor users only see the TVs.

      You should look into Content Blocks at ModMore. It's not free, but it is a very nice way to build up sections within resource content. https://www.modmore.com/extras/contentblocks/
        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
      • discuss.answer
        • 4172
        • 5,888 Posts
        there is renderResources to get the complete rendered Resources
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Hm. I hadn't thought of that one before, it could be used in a getResources tpl chunk. I'll have to give that a try.
            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
            • 3749
            • 24,544 Posts
            $modx->sendForward() will pull the whole resource into the current URL. I think it will use the template of the other page, but I can't remember for sure.
              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
              Well, in a single-page site you don't want multiple full templates, just enough of a template to format the section being loaded.

              The whole purpose of a single-page site is so the user isn't requesting and downloading pages. It's all on the same request. Although AJAX can be nice for bits and pieces, such as content loaders for a section full of blocks (see the What We Do section of this site for an example of a multiple-section page with an AJAX content loader)
                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
                • 51020
                • 670 Posts
                Quote from: Bruno17 at Nov 14, 2015, 12:09 AM
                there is renderResources to get the complete rendered Resources

                Thanks all of your input - RenderResources did exactly what i needed - it's perfect - thanks!!
                  • 46886
                  • 1,154 Posts
                  If I may ask a question, would we call it a one page site if it was a background with just one content block (if I may) in the center which toggles left and right to say 5-6 pages of content?

                  Or are we talking specifically about the "scroll down" sites with multiple parts stacked on each other?

                  I am just trying to conceptually grasp this. I recently saw a 6 "page" site designed as above and it was very nice, powerful and focused.
                    • 51020
                    • 670 Posts
                    The site in question is scrolling vertically, but you could use Modx in more or less the same way to create more of a one page slider site.
                      • 46886
                      • 1,154 Posts
                      Ok thanks, just wanted to understand the terminology