We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 48172
    • 3 Posts
    Hello everyone,

    at the moment i am making the first tests with modx and i really like it. Of course i have many questions smiley

    First of all, thanks for the great product and the nice forum here.

    My first question is:
    Can i Pre define Template Variables per category?

    An example:

    We have gaming, movie and music news on our website. We will have several editors. Each of the topics like gaming movies and music will have its own category. I define the look my music, gaming and movie news with template variables like a picture, trailer, all sorts of info.

    What i want to do is the following:

    When the editor creates a new entry for a movie, i want to automatically load the following template variables for him to fill out:

    - Movie Name
    - IMDB Link
    - Trailer code youtube

    At the moment i have to add and sort these template variables every time i create a new content. When i create a new music news, it has to have a own set of template variables pre loaded.

    I hope you understand what i am trying to ask here smiley

    Thank you very much for your help,

    Greetings smiley
      • 3749
      • 24,544 Posts
      I'm afraid I don't understand your question. Is the user creating the entry in the front end (if so, how?) or in the Manager?

      In the Manager, the TVs will automatically be there if they are attached to the template assigned to the resource, so using one template for each category would do what you want.

      In the front end, they would also be there every time if they're part of the form the user is filling out, so I don't know what you mean about having to add them in yourself for every new entry.
        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
        • 48172
        • 3 Posts
        Hello BobRay,

        thank you for your answer. I am talking about entries in the backend.

        When i am using the templates, the tamplate variables are still not pre loaded and must be added manually.

        Greetings
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Ah. You need to look into MIGx. It provides multiple fields for a single TV.

          Each "category" will have its own template, with a MIGx TV assigned to it. So when the user creates a new "Movie" page, it will have the "movie" TV ready to edit. By default, resources inherit the template of their parent, but there are add-on plugins to have them use the template their siblings use if the child resources should be different than the parent's.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 3749
            • 24,544 Posts
            Still not getting you. When you edit a resource in the Manager, all TVs attached to the template should be there on the "Template Variables" tab, unless you've hidden them in some way. Their *values* will be blank. Are you talking about entering those?

            If you want the TVs on the main tab, you can move them there with Form Customization.

            When you say you "added manually," what are the steps you're taking to add them? Maybe that will help me understand your question.
              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
              • 48172
              • 3 Posts
              Hello BobRay,

              sorry, my english is not the best. I will try it with screenshots smiley

              When i click on Template Variables (screenshot 1), on the left side i have my categorys, in my case blocks. Now i have to add manually all the template variables i need. When i am finished, it looks like on screenshot 2.

              What i want to have is that when i add a new document with the template, i want the template variables be pre populated like on screenshot 2, without the need to add them by hand all over again.

              I hope you understand me now smiley

              Thanks and greets

                • 3749
                • 24,544 Posts
                Ah, you never mentioned that you were using MIGX. I get it now, but someone who knows more about MIGX will have to answer.
                  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
                  • 4172
                  • 5,888 Posts
                  you can prefill the MIGX-grid with input-option-values as a json-array.

                  the json should look like that:

                  [
                  {"MIGX_id":"1","name":"Form","layout":"","active":"0","editablefields":"layout,active"},
                  {"MIGX_id":"2","name":"Chunk","layout":"","active":"0","editablefields":"layout,active"},
                  {"MIGX_id":"3","name":"Table","layout":"","active":"0","editablefields":"layout,active"},
                  {"MIGX_id":"4","name":"Anchor Haedline","layout":"","active":"0","editablefields":"layout,active"},
                  {"MIGX_id":"5","name":"Related Topics","layout":"","active":"0","editablefields":"layout,active"},
                  {"MIGX_id":"6","Anchor Navigation":"Form","layout":"","active":"0","editablefields":"layout,active"}
                  ]


                  This json could also be created by script and @EVAL or @CHUNK - binding
                  [ed. note: Bruno17 last edited this post 12 years, 2 months ago.]
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!