We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5532
    • 251 Posts
    Hi There,

    For site-wide sidebar and footer content, I’ve been creating dedicated footer and sidebar pages that are hidden, then using ditto calls inside footer and sidebar chunks to display that content across the site. Lately I’ve expanded this way of working to include sidebar drop-down lists which run ditto calls and things have become quite involved (for a designer). See here for exactly how I’m using Ditto: http://modxcms.com/forums/index.php/topic,44411.msg264724.html#msg264724

    With a larger site in development (about 500 pages when launched) it’s suddenly occurred to me that using Ditto in this way might be creating a lot extra extra work for the server, slowing the site down as we add more pages.

    Some pages could end up with as many as 7 or 8 ditto calls (header, footer, 4 sidebar blocks, a jquery slider plus an aggregated content area) - is this going to be OK? To add to the processing, all our css and script includes (even the Google analytics code) are all inside chunks which are then nested inside a footer chunk that is placed into the templates - this allows us to edit them in one place (the chunk) and have them updated site-wide.

    If this sounds like it will cause major performance issues, what would be the best way to set this up?

    As an example, I’ve just discovered @BINDINGS - can you use the @DOCUMENT binding in a TV on one page to grab content from another and would that be faster that Ditto? The nice thing about Ditto is that if I need to change the HTML for the footer (or other elements), I can do that once in the footer chunk.

    Any suggestions would be welcome - starting to feel a bit nervous...

    Cheers
      • 8609
      • 607 Posts
      Not sure about the benefits/pitfalls of using Ditto for this. For that kind of thing I generally use chunks and find them more efficient.

      I use Ditto mostly to aggregate content into one page.
        • 5532
        • 251 Posts
        Thanks for the reply.

        So do people get their clients to edit chunks using HTML? I just can’t imagine most of my clients doing this - especially as website sidebars (footers especially) have become such an important part of the content mix.

        What about @Bindings? Can they be used to grab TV data from a page, then format the data with less overhead?
          • 26931
          • 2,314 Posts
          So do people get their clients edit chunks using HTML? I just can’t imagine most of my clients doing this - especially as website sidebars (footers especially) have become such an important part of the content mix.
          you could also use a TV with @Document Binding http://www.sottwell.com/tv-bindings.html

          or the getField Snippet: http://modxcms.com/extras/package/?package=173
            • 5532
            • 251 Posts
            Thanks for the reply,

            Would the getField snippet be faster than Ditto as isn’t Ditto also a snippet? Forgive my ignorance as I don’t know any PHP - must learn one of these days...

            Yes, I’ve been wondering about the @Document binding but as I don’t understand PHP I kind of need some examples - Sue’s page doesn’t go into the @Document binding and I think Google strips the ’@’ when you search for @Document. Plus this Modx documentation page here doesn’t include anything: http://svn.modxcms.com/docs/display/MODx096/%28at%29DOCUMENT

            "It’s a mystery wrapped up in an enigma" - seriously, will search the forums etc...

            If I did use the @Document binding, do you know if I can use a chunk to format the output?
              • 5532
              • 251 Posts
              This page has an example here: http://wiki.modxcms.com/index.php/%40DOCUMENT_Binding

              But it also states:
              In MODx, use the @Document Binding in a custom template variable field where you want to include a rendered page; it can be similar to using a Chunk

              The "include a rendered page" bit is making me think it will display the entire page - will have to test things out.

              But overall, does anyone know if these suggestions will be faster than Ditto?
                • 8609
                • 607 Posts
                Quote from: cms at Feb 17, 2010, 11:06 AM

                Thanks for the reply.

                So do people get their clients to edit chunks using HTML? I just can’t imagine most of my clients doing this - especially as website sidebars (footers especially) have become such an important part of the content mix.

                What about @Bindings? Can they be used to grab TV data from a page, then format the data with less overhead?

                I was talking mostly about the sitewide stuff that doesn’t get edited on a regular basis, like header and footer.

                For the other stuff that clients will edit I use TVs.
                  • 5532
                  • 251 Posts
                  Yes, I guess footers are becoming less and less static these days. Will dig around the @Binding stuff and see what I come up with.

                  BTW Mary, I wish I’d discovered The Coding Pad 6 months ago - nice work...

                  Cheers

                  Ben
                    • 5532
                    • 251 Posts
                    After digging around on Google, the Modx Wiki and the Modx Forums, I’m still having a hard time piecing this all together.

                    This all assumes that @Bindings will result in less server load than Ditto on a page that could end up with 7 or 8 Ditto calls (if the client selects every sidebar option) - if it won’t be faster then please sing out so I can put this to rest!

                    @Document
                    The thing I don’t understand with this binding is how you specify both the document to get the content from, as well as the actual content. If I have a Footer page setup with 4 Footer TVs in it, presumable if the "Input Option Values" or "Default Value" fields are set to:
                    @Docment 20


                    When I go to document 20 to enter the content I won’t be able to - or will the Rich Text editor on document 20 override the binding?

                    Not sure if I’m even on the right track, so please sing out if this is a waste of time...

                    Cheers

                      • 5532
                      • 251 Posts
                      I’m clearly missing something basic here...

                      I have a test chunk placed in the home page called {{footerTest}} and it looks like this:
                      <!-- START FOOTER -->
                      <div id="footerWrap">
                      <div id="footer" class="centre">
                      
                      <!-- START TEXT BLOCKS -->
                      <div class="textBlock6">
                      [*footer1*]
                      </div>
                      </div>



                      The [*footer1*] TV has the following in the "Input Option Values" (have also tried "Default Value"):
                      @Document 25

                      And the Footer template is ticked so it is available on the Footer page.


                      Page 25 is my Footer page and I have entered some dummy content like this:
                      <h3>This is footer1.</h3>
                      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
                      <p><a class="small green button" href="#">Small green button »</a></p>


                      When I render the page, all the HTML is there but there is a gap instead of content like this:
                      <!-- START FOOTER -->
                      <div id="footerWrap">
                      <div id="footer" class="centre">
                      
                      <!-- START TEXT BLOCKS -->
                      <div class="textBlock6">  </div>
                      </div>



                      So maybe the @Select binding is the way to go as the example here http://svn.modxcms.com/docs/display/MODx096/%28at%29SELECT shows:
                      @SELECT pagetitle FROM [+prefix+]site_content sc LIMIT 10


                      This statement seems to show you can choose the TV from somewhere- although I know zero about SQL queries so could be wrong. Also, accessing the Database directly seems scary...

                      I’ve obviously misunderstood what these @Bindings are, or how to use them - if anyone with a shred of Modx talent could help explain things, that would be radical.