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

    I’m about to start building my second site using MODx (095) but there’s one feature that the client would like that I can’t quite figure out how to achieve. On the homepage there will be an area with a small box showing the top 3 latest news headlines and another showing 3 random job vacancies. Each of these boxes will be a <div>.

    The client would like the ability to be able to hide either of these boxes at any time and to replace it with a simple box with just copy. Can anyone help with a suggestion as to how this might be achievable? I think that TVs might be able to do this but I’m not sure ...

    Many thanks
      • 11975
      • 2,542 Posts
      Hi,

      you can easily do it with modx.

      Create a tv type=>listboxmultiple or checkbox
      options values => latest News=={{latestNews}}||latest Jobs=={{latestJobs}}||simpleBox==@DOCUMENT ID_of_your_doc

      In {{latestNews}} your ditto call
      and so on ...

      That way your client will be able to activate the items to display
      Adding @INHERIT to the default value in tv settings will propagate the client choice to the childrens of the document.
      The only limit is that you cannot change the order of items.

      :-)
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 25663 MODX Staff
        • 12,272 Posts
        Ditto’s SVN code indeed now contains support for randomization of results in conjunction with a limit. Was finished just yesterday in fact. Here’s an example of how I use it:

        Client quotes are stored in an unpublished container (38) in the [*content*]; there are 22 of them. The client wanted a randomly selected quote to appear on the page. Here’s the call:
        [!Ditto? &parents=`38` &tpl=`home-page-quote` &randomize=`1` &limit=`1`!]


        Ditto’s public SVN trunk: http://svn3.cvsdude.com/ditto/codebase/
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 12151
          • 115 Posts
          many thanks heliotrope, that makes sense. i’ll give it a whirl.

          but whilst i have you ear ... tongue

          in order to allow the client to add individual job vacancies they will need to be able to enter various custom fields, like title, start date, salary, and so on. how could i go about creating such areas for the client to add in this info? would this also be TVs? or is there a sneaky way to actually create custom content fields?

          cheers
            • 25663 MODX Staff
            • 12,272 Posts
            TVs indeed.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 10470
              • 48 Posts
              I like the new random param grin
                • 25663 MODX Staff
                • 12,272 Posts
                I will be using the new random param in fact with scheduled publishing as a simple ad management system in MODx. "Toe rings" will no longer be the sole ad on the main site. LOL smiley
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 12151
                  • 115 Posts
                  genious!
                  many thanks to you both smiley