We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37003
    • 12 Posts
    benmason1983 Reply #1, 15 years ago
    Thanks so far for all the help.

    So from a few posts and reading the forums i've now got 1 template, with a TV asking if you want 1 2 3 main columns / rights columns etc and then inserting that output to a stylesheet to then show or hide divs based on the users input. Not sure if this is the best way to do this but i'm still learning.

    My next question is, lets take right col 1 for example. I want to have 3 choices for the user
    1) Pick a pre built piece of content to include (something thats repeated like contact details

    or
    2) Title
    3) Content

    So is it possible in the TV to have a list of pre built content that a user can select to include and if nothing chosen ignore and use content from 2 / 3 to build that module

    Thanks for any more help.
    Ben
      • 10076
      • 1,024 Posts
      Hi,

      understand well that you want the user to be able to eg tick a box to make that pre built content appear in col_1. Or another box to just show a title (h1?) and another one to show just content? Would the latter be pre built? Or a document in the tree the user can create?

      Anyway, you could eg use ditto. So make a container, in there you put you prbuilt content in the form of documemnts.

      Make a tv eg "box01" with a choice for these document id inside that container. In the tpl you could use place holders [+pagetitle+] etc. Create one tpl per choices you want and a tv (iBox01 as example) that would point to those three different tpl chunks

      ANd create a call with that TV in it:

      [!Ditto? &documents=`[*box01*]` &tpl=`[*iBox01*]` &display=`1`&noResults=` `!]

      now box01 would fill out the number of the doc you want to show and Ibox01 would give the choice on how to show it. Hope it sounds okay, best, Frank.
        • 37144
        • 5 Posts
        I'm a little fuzzy on your second part, but your first part I can help with.

        I'm assuming you want something like this http://grab.by/aYid a way to select from some pre-formatted / built content.

        Here is how we did it. http://grab.by/aYih pretty much we're pulling in a category of chunks into a check box list. the snippet GetChunks is being used to load that.

        @EVAL return $modx->runSnippet('getChunks',array('category'=>'Side Widgets'));

        http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks here is some more information.


        Now you can expand this further to answer your second part and use output filters to conditionally have 1 2 or 3 columns based on what is selected. http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+%28Output+Modifiers%29

        Something like this might work.

        [[*side-widgets:ifempty=`
        <div class="single-column">
        [[*content]]
        </div>`:notempty=`
        <div class="first-column">
        [[*content]]
        </div>
        <div class="secondary-column">
        [[*side-widgets]]
        [[*other-things-to-include]]
        </div >`]]
          • 10076
          • 1,024 Posts
          Smart Shawnh, realy nice solution
            • 10076
            • 1,024 Posts
            dont know if this is evo or revo, but as for the columns, there s this solution too, for EVO, by Susan Otwell. TV call goes before the end head tag </head>
            A TV, radio options point to following chunk ( and there could be more chunks:

            Hide Sidebar=={{twoColumns}}||Show Sidebar=={{threeColumns}}


            The chunk, two column, just hides a column and changes width:

            <style type="text/css">
            #extras {display: none;}
            #content {margin:10px 0 10px 160px;}
            </style>
            :

              • 37003
              • 12 Posts
              benmason1983 Reply #6, 15 years ago
              Thanks for taking the time.

              Couldn't get it working via the screenshots, but following the link and creating the snippets i've got it parsing.

              The next part has stumped me though.

              Trying to get to show check box if selected else show manual way. Tried this bit of code but think i've gone a little wrong.

              [[!chunkListParser?chunks:ifempty=`[[*rightNavBoxCheck1]]`:notempty=`[[$rightNav1]]`]]
                • 18373 ☆ A M B ☆
                • 3,141 Posts
                Mark Hamstra Reply #7, 15 years ago
                Try

                [[!chunkListParser:empty=`[[*rightNavBoxCheck1]]`:notempty=`[[$rightNav1]]`]]
                  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.
                  • 37003
                  • 12 Posts
                  benmason1983 Reply #8, 15 years ago
                  Thanks Mark

                  Getting closer, but still not what i'm expecting.

                  Now when i click on either of the radio buttons for my tv it still showing the contents of rightNav1

                  Yet if now radio buttons selected i don't get anything showing.

                  Not sure if i'm just way of the mark. What i'm trying to do is check if a button has been selected in my tv, if yes pull in the content of the chunks, if it's empty and nothing selected then show $rightNav1
                    • 18373 ☆ A M B ☆
                    • 3,141 Posts
                    Mark Hamstra Reply #9, 15 years ago
                    So if the checkbox is empty you want to display your chunk, and else the chunkListParser snippet?

                    [[*rightNavBoxCheck1:empty=`[[$rightnav1]]`:notempty=`[[!chunkListParser]]`]]

                      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.
                      • 37003
                      • 12 Posts
                      OK, now when there is no radio button selected is shows the content, but not parsing the !chunkListParser

                      Putting in another chunk shows that, so it's now outputting the snippet,

                      Placing the snippet
                      [[!chunkListParser?chunks=`[[*rightNavBoxCheck1]]`]] 
                      gives me an output on it's on but not with the empty / notempty [ed. note: benmason1983 last edited this post 15 years ago.]