We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Chunks are simply er... chunks of plain text or HTML, and are inserted as-is into a document being processed. If there are any MODx tags in the chunk content, they will be processed during the next pass through the parser (a maximum of 10 passes in all). They are often used for basic content, such as footer or header content, that will be used on all pages, even if the pages use different main templates. This way you only have to change the address or phone number in your page footers, for example, in the chunk, and the change will work across all pages no matter what template they use.

    Chunks are also useful if you need to have a very long, complex snippet call with lots of parameters, and need to use the rich text editor on the document. The rich text editor can "helpfully" totally trash the snippet call’s parameter list. So putting the snippet call in a chunk, then using the chunk tags in the document content will protect the snippet call.

    http://sottwell.com/how-templates-work.html

    Wayfinder, Ditto and a number of other snippets are coded to use given chunks as mini-templates for the various parts of their output. Usually these mini-template chunks will contain HTML code and [+ ... +] placeholders, which are taken from an array that MODx uses to store output or other values that snippets can produce for later use.

      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
      • 4429
      • 429 Posts
      What if you don’t use SEO friendly urls (or more correctly is your server doesn’t fully support it)?

      How does this actually work?

      Would I produce my site as:

      Root
      --EN
      ----Home
      ----Products
      --DE
      ----Home
      ----Products
      --NL
      ----Home
      ----Products

      What would happen is say English and Dutch held some different content e.g the English section has a news page but he other countries do not?

      i’d want English to be the default site, with links at the bottom of the home page to change the language.

      If you are using CSS sprites for the menu, how does this automatically change the menu image?
        • 29774
        • 386 Posts
        @c-m

        using separate document roots for each language would risk running into the approximate 5000 document limit - with 30 odd languages you could approach this quickly. The other approach is to use TVs (you’d need at minimum 60+ for your template - pagetitle + content ), but this is also more than the optimal 20 or so TVs before things start to slow down (so I’m told - I’ve never used more than this); however, this might be your best approach providing the output of your page is cached after the first view (this bit is critical). There is a snippet/module/plugin in development that will do this:

        http://modxcms.com/forums/index.php/topic,35940.msg217368.html#msg217368

        The better alternative however might be to use Revo which introduces a new concept called Contexts for exactly this type of problem.



          Snippets: GoogleMap | FileDetails | Related Plugin: SSL
          • 4429
          • 429 Posts
          At the moment I only have translations for about 4 languages that will be 30 pages each.

          The other languages will come in but his will probably be over a year and a half before i have all them. By that time Modx 3.0 might be in beta wink


          I’m happy to give this method a go with a couple of languages, it beats the alternative that was to have each language as seperate modx install shocked

          What exactly does this part mean in the opeing post:

          Enter a languageIdentifier for every page. It could be the same as your alias for example.

          does that mean for each page i should set the alias to something like product-nl, home-nl, home-de etc....?


          Create a new template variable with name "languageIdentifier"

          What goes in this TV is it rawtext, richtext etc.. where is it called?

          I’d love to see a working example
            • 8790
            • 526 Posts
            Hi Susan,


            Can you tell me if this context stuff would be something like a virtual root ?

            is this close to some Directory concept (like Novell eDIR for instance with the CX container ?)

            Thank you
              Schtroumpf Grognon - Grouchy Smurf
              ---------------------------------
              Faites pas attention.. - Don't pay attention
              http://www.dzi-neo.net
              • 4429
              • 429 Posts
              Ok this works fine - wohoo.

              My problem is that for each language I have a different CSS image sprite for the menu.

              Is the only way to have the menu show correctly to create a template for each seperate language?
                • 8790
                • 526 Posts
                hi c-m


                I suggest you have a look to PHX, wich is the only (afaik) way to intriduce some logic into modx template without snippet.
                here : http://wiki.modxcms.com/index.php/PHx#Snippets_supporting_PHx

                some basic example:
                [+phx:if=`[+this+]`:is=`[+that+]`:then=`do this`:else=`do that`+]
                


                you can test [+Language+] to determin what chunck to fire.
                  Schtroumpf Grognon - Grouchy Smurf
                  ---------------------------------
                  Faites pas attention.. - Don't pay attention
                  http://www.dzi-neo.net
                  • 4429
                  • 429 Posts
                  Thanks, as a non programmer who only understands copy paste copy paste, I think i’ll just go for different templates for the time being. I will look into this was more of the languages get translated.
                    • 4429
                    • 429 Posts
                    I have all the flags in a list horizontally across the bottom of my index page.

                    However how do I hide the text next to the flags?
                      • 8790
                      • 526 Posts
                      hhh..
                      You should have some html skill isnt’it ? just look at the img tag

                      This a question of css or you can modify the template chunck use for this ’flag menu’ and delete the text from the <a> tag

                      <li class="[+wf.classnames+]"> <a href="[[link_to_language?id=`[+wf.docid+]`&link=`[+wf.link+]`&actualid=`[*id*]`]]" title="[+wf.description+]"><img src="[(base_url)]assets/images/flags/[+wf.linktext+].gif" alt="[+wf.linktext+]"  /> [+wf.title+]</a></li>


                      see ? here :
                      .....<img src="[(base_url)]assets/images/flags/[+wf.linktext+].gif" alt="[+wf.linktext+]" />&nbsp;[+wf.title+]</a>
                        Schtroumpf Grognon - Grouchy Smurf
                        ---------------------------------
                        Faites pas attention.. - Don&#39;t pay attention
                        http://www.dzi-neo.net