We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21419
    • 84 Posts
    I’m looking for a method for a manager to select content from existing resources via drop-down menus within another resource.

    I’m currently developing a site for a client and am trying to make the Manager as simple as possible for them. Most of the site is well organized and handled by TVs that are clearly labeled and limited to the appropriate templates.

    The home page is a whole other ball of wax. It currently has 6 slots linking to sub-pages within. This a site promoting a group of restaurants, so each slot links to a different restaurant. I want to offer them flexibility in deciding what goes where. The slots are different sizes, with the "Main Art" being larger than all the others. At this point, the layout is fixed - in terms of slot placement.

    What I would like them to be able to do is create and edit the content for each slot independent of the Home Page Template itself. So the content blocks would be individual "pages" within the Home Page container. And then I’d like the Home Page template to allow them to simply select the desired content from a pulldown menu, like this:

    Package (Main): <selection box>
    Package (Bottom Left): <selection box>
    Package (Right Top): <selection box>
    Package (Right Middle): <selection box>
    Package (Right Bottom): <selection box>
    Package (Page Bottom): <selection box>

    I’m just not sure how to accomplish this. I can get selection boxes working to choose data, but not select the entire contents of a page unless the content of the page is resides in the "Content" field. All of the pages in the site use template variables to generate the content and, for this particular page, I’m hoping to create several Package Types as templates and then create the page content using the TV fields available in these templates.

    I’m not sure if I’m explaining this clearly. I keep interrupting myself as I come up with different ideas (Ditto, PHx), but I have to think somebody has accomplished this before.

      • 3749
      • 24,544 Posts
      I’m not sure I know what you want (it sounds like a hard situation to explain).

      If I’m getting you at all, the main problem is that you want to pull more than the content field from the selected documents.

      Have you tried the @DOCUMENT binding for your TVs?

      You might also think about Ditto, which can pull pretty much anything out of a document and organized it however you want. Remember, too, that Ditto will accept TVs in its parameters and those TVs can be in the form of drop-down lists, checkboxes, or radio options.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 21419
        • 84 Posts
        I was trying an @SELECT, but @DOCUMENT might be better. Ditto does seem like at least part of the solution. It is a little difficult for me to explain.

        Imagine you’re designing a tool for a total web noob who needs to choose which content is to go into which spot on the page. The simplest way I can think of is to offer them choices in a pull-down menu.

        Example:
        For Slot A, they have 2 choices, "New Restaurant Promo" and "Old Rstaurant Promo"
        They choose "New Restaurant Promo".

        "New Restaurant Promo" uses a custom template and includes TVs for:
        [*promo-headline*]
        [*promo-art*]
        [*promo-text*]
        [*promo-link*]

        "Old Restaurant Promo" uses a different custom template and includes TVs for:
        [*promo-headline*]
        [*promo-background-image*]
        [*promo-art*]
        [*promo-link*]

        How do I generate the options for the select box?
        How do I get their selection to insert the related content and not just the string "New Restaurant Promo" from the select menu?
          • 3749
          • 24,544 Posts
          I think I get it now. If I do, it doesn’t look that difficult.

          First, you may know this, but a drop-down list TV with this setting for Input Option Values:

          One==1||Two==2||Three==3


          Will show the user a list containing One,Two,Three. When they make the selection, the actual value of the TV will be 1, 2, or 3. That’s handy if you need to put long paths or tags in the TV but don’t want to show them to the user.

          I’m assuming that New Restaurant Promo and Old Restaurant Promo are chunks containing those four TV tags (lets call the chunks NewRP and OldRP).

          The Input Option Value for the TV for slot A would be:
          New Restaurant Promo=={{NewRP}}||Old Restaurant Promo=={{OldRP}}


          The only issue here would be the parsing order. I’m not sure if the TV tags in the chunks will be parsed. I think they will, but I could be wrong. If they’re not parsed, you could use a snippet to get the chunks and construct the formatted output for each section. Then, in place orf {{NewRP}} and {{OldRP}}, you’d have this:

          [!GetSections? &choice=`NewRP`!]
          [!GetSections? &choice=`OldRP`!]


            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 21419
            • 84 Posts
            You are definitely understanding what I’m trying to do. I’m going to try this approach and report back. Thanks for the feedback.