We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32986
    • 17 Posts
    Template Variable Call Chunk...i think would be graet..//create a tv...with textbox as an input..then put chunks to it... smiley
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      What do you mean exactly?

      Selecting a chunk using a TV and outputting it in the template?


      If so, you can pretty much do that already.
      Make a new drop down TV, and add the chunk names you want to be able of selecting as options.
      Chunk1||Chunk2||Chunk3 etc


      Then, make a snippet "tvChunk" (or anything you want) and give it the contents:
      <?php
      return ($chunk) ? $modx->getChunk($chunk) : "No chunk specified";
      ?>


      In your template, call it with [[tvChunk? &chunk=`[*tv*]`]].


      (Note: the above is untested code)
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 32986
        • 17 Posts


        like this..the template variable name is [*sidebar*] and i have different sidebar set of links (i don’t use wayfinder since it’s multiple sidebar and its confusing)..so instead of posting the whole html code of my chosen sidebar i want it to be chunk so it can save time..anyway if there is an other way please help..thanks..
          • 26931
          • 2,314 Posts
          Hi xzsurf,

          i guess you are looking for TV-Based Chunks: http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks
            • 32986
            • 17 Posts
            Quote from: sharkbait at Jun 24, 2010, 11:53 AM

            Hi xzsurf,

            i guess you are looking for TV-Based Chunks: http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks


            holy ****...thanks..that’s why i posted it to wishlist..because its so COMPLICATED smiley..i hope modx make it easier for designers..because the links is giving me PHP gibberish....(i don’t know how php works but i can understand some basic wordpress php codes but this one..is off the hook)
              • 26931
              • 2,314 Posts
              actually you don’t even need a Snippet

              Chunk01=={{Chunk01}}||Chunk02=={{Chunk02}}
              ...would work, too
                • 25260
                • 156 Posts
                Quote from: sharkbait at Jun 24, 2010, 12:01 PM

                actually you don’t even need a Snippet

                Chunk01=={{Chunk01}}||Chunk02=={{Chunk02}}
                ...would work, too


                woah that’s great

                I must keep that in mind!
                  • 32986
                  • 17 Posts
                  Quote from: sharkbait at Jun 24, 2010, 12:01 PM

                  actually you don’t even need a Snippet

                  Chunk01=={{Chunk01}}||Chunk02=={{Chunk02}}
                  ...would work, too



                  thanks for patience and time...

                  am i doing it right? so i will create a list box...e.g my chunk is chunk1 -> chunk3

                    • 26931
                    • 2,314 Posts
                    Input Type: DropDown List Menu
                    Input Option Values: Chunk01=={{Chunk01}}||Chunk02=={{Chunk02}}

                    ...and if you need a default value e.g. Chunk02:
                    Default Value: {{Chunk02}}
                    otherwise leave it empty

                    edit: ==||Chunk01=={{Chunk01}}||Chunk02=={{Chunk02}} will give you an initial blank/empty value

                    ... + assign the TV to the template you are using
                      • 32986
                      • 17 Posts
                      Quote from: sharkbait at Jun 24, 2010, 12:12 PM

                      Input Type: DropDown List Menu
                      Input Option Values: Chunk01=={{Chunk01}}||Chunk02=={{Chunk02}}

                      ...and if you need a default value e.g. Chunk02:
                      Default Value: {{Chunk02}}
                      otherwise leave it empty

                      edit: ==||Chunk01=={{Chunk01}}||Chunk02=={{Chunk02}} will give you an initial blank/empty value

                      ... + assign the TV to the template you are using

                      thank you it works!! your the man your the man!!!