We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26503
    • 620 Posts
    hm, ok - I have a standard 2 column layout content on the left and callouts/boxes on the right. in each section of the site the callouts/boxes change slightly from page to page.
    Previously I have been using different templates to ’switch up’ the boxes. It occurs to me that there must be a better/easier/more elegant way of doing this.

    So, how do I change up the right hand column content without having to create different templates of each page?

    -thanks
    -sean
      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525
      • 33968
      • 863 Posts
        • 26503
        • 620 Posts
        interesting - thanks, will look into it.
          *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

          Sean Kimball CLP, CLS.
          Technical Director / Sr. Developer | BigBlock Studios
          ._______________________________________________.
          Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
          27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
          phone/fax: 905-426-5525
          • 8214
          • 28 Posts
          Yes I also used multiple templates to achieve the same effect. But it gets cumbersome after awhile...
            • 8214
            • 28 Posts
            The wiki info is...brief.

            I found two older threads that seem to deal with what I am looking for at least. I just want my different sidebars called for different sections, they all look the same, just different links inside. Got many many templates with different chunks, now. Which doesn’t work all that great.

            Haven’t tried these yet but will soon...the first one seems more useful so far.

            http://modxcms.com/forums/index.php/topic,481.0.html

            http://modxcms.com/forums/index.php/topic,294.msg1728.html#msg1728
              • 33968
              • 863 Posts
              I thought the wiki was quite detailed. There’s another way you could do this, especially if you don’t need the user to pick and choose which chunks to display.

              Assuming you are using Revolution:

              • Install the Switch and UltimateParent snippets.
              • Create a chunk for each variation of your sidebar, and paste the sidebar html (including any modx tags) into each chunk.
              • Delete all your ’sidebar variation’ templates (back up first!) and leave only the templates you need to display your content.

              Then go into the remaining template(s) and replace the sidebar content with something like this:
              [[switch? 
                  &get=`[[UltimateParent]]` 
                  &c1=`1` &do1=`[[$chunk1]]`    
                  &c2=`2` &do2=`[[$chunk2]]`    
                  &c3=`3` &do3=`[[$chunk3]]`   
                  &default=`[[$chunk4]]`  
                  ]]
              

              Where [[UltimateParent]] returns the id of the topmost container for the current section.

              Basically we’re saying:
              ’if section parent is 1, display chunk1’
              ’if section parent is 2, display chunk2’
              ’...’
              ’if no condition met, display chunk4’

              Try it out!
                • 8214
                • 28 Posts
                Wow Lucas thanks for dropping the knowledge! Something like that would work without a doubt, I do not need the user to decide anything, I just want to associate pages (according to their content) with different sidebar navigations.

                Now, this is Sean’s thread really, so I don’t want to hijack it, but I am using Evolution. Does that change anything major?
                  • 26503
                  • 620 Posts
                  Scanned over most of these posts and tutorials, none of them seem to do exactly what I would like:

                  - I would like all my call-outs in chunks [the client currently has 5 & like to add/change them from time to time]
                  - I would like to create a set of TVs that allow the call-outs to be selected from a drop down list of available call-outs
                  -- i.e. there would be 5 TVs "slots" that allow the user to choose ’none’ ~or~ an available call-out chunk
                  in our actual template the call-out column would look something like

                  <div id="call-out-column">
                       [[$[[*_TV_VAR_]]]]
                       [[$[[*_TV_VAR_]]]]
                       [[$[[*_TV_VAR_]]]]
                       [[$[[*_TV_VAR_]]]]
                       [[$[[*_TV_VAR_]]]]
                  </div>
                  


                  Now, I know that can’t be the right syntax for using a TV value as a chunk name, but it seems logical that something like this could be possible?
                  As for setting defaults based on section, this doesn’t work, but we can set some of the TVs to be globally displayed as default, then just select/deselect call-out chinks on a page by page basis....

                  Sound reasonable?
                  Thoughts?

                  -sean
                    *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

                    Sean Kimball CLP, CLS.
                    Technical Director / Sr. Developer | BigBlock Studios
                    ._______________________________________________.
                    Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
                    27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
                    phone/fax: 905-426-5525
                    • 4172
                    • 5,888 Posts
                    you can just use a checkbox-TV with input-option-values like

                    chunk A==[[$chunk_A]]||chunk B==[[$chunk_B]]||chunk C==[[$chunk_C]]


                    Of course its possible to fill input-option-values dynamically with @EVAL - binding
                    So you can use a small script, which gets chunks which are under a given category for example.

                    If you want to be able to reorder them from resource to resource by drag/drop you can use mademydays sortable-checkbox-input-TV-type

                    in your template you will only need
                    [[*TV_VAR]] 


                    another option is to create a own custom-tv-input-type which does exactly what you need
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 33968
                      • 863 Posts
                      Sean - what you could do is this:

                      In your template...
                      <div id="call-out-column">
                           [[*call-out]]
                      </div>
                      


                      Create a TV named ’call-out’ (as above) with the following values set:

                      Input Type: Dropdown List
                      Input Option Values: None==[[$]]||Chunk1==[[$chunk1]]||Chunk2==[[$chunk2]]
                      Default Value: Chunk1==[[$chunk1]]

                      First off, if you set Input Type to Dropdown List, only one chunk can be selected to be output to the page. Not sure exactly what you required, but if you wanted the user to select more than one you could change to ’Checkbox’ type to allow this.

                      Input Option Values are of the format Label==Value. ie. ’Chunk1’ will appear in the drop down menu while MODx uses the value of [[$chunk1]], displaying that chunk on your page. Add as many options as you want here, making sure they are separated by a double pipe ’||’.

                      You could also set the default value to @INHERIT which will allow child resources to initially inherit their parent’s value for this TV (until changed by the user).

                      For a better explanation have a quick read through this (written for Evo but concept is the same).

                      EDIT: Just saw Bruno’s post. Same idea tongue