We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21946
    • 283 Posts
    Hello
    I’m triyng modx revolution right now

    TVs seems to be still tied to templates, like in modx evo. I’m not sure to understand why :
    - TV help you to build a custom form to create a specific content type (let’s say : news, event etc...) - data structure -
    - templates are just how you show datas on your site - data presentation -

    So yes, ofen you need to create a template for a specific content type, but not always

    It means that with modx-revo, if i want to create a new custom form (with TV i mean), i have to create a template ?
    isn’t that a little weird ? It will lead me to dupplicate templates if i want different content types to have the same presentation ?
      [url=http://www.savepoint.fr/index.php?id=38] -petits tuyaux pour les d
    • Quote from: nyl
      It means that with modx-revo, if i want to create a new custom form (with TV i mean), i have to create a template ?

      I don’t think so.

      You can re use your existing template since it’s just a presentation layer.
      However, if you create a new template for your existing website, you’ll have to pair it also with your existing TV if needed.

      It only allow to have specific TV usable with paired template, but TV are not tied to a tempalte specifically.

      I may have misterdunstood you.
        • 21946
        • 283 Posts
        maybe because i work with drupal for almost two years now (i was using modx evo before that), i find strange that you have to Bind TV to a template in order to see them. That’s to say :
        - TV allows you to build custom forms, with fields you need to save in BDD values that you want to print or filter with getResources.
        - But you have to bind them to a specific template, you cannot build several custom forms that will be outputed in front-end with the same template. Am i wrong ?

        That leads me to create a new template when i want a new form, even if those two custom forms could use the same template in front-end

        It seems that custom forms and how they are themed by template is the same thing for modx revolution. But they do two different things :
        - custom managers forms (with TVs i mean) allow us to save datas in a certain way in the database
        - template allows us to print a page in a certain way

        i’m feeling a little confused by this association, even if i know how modx works. In modx evo, i used to dupplicate templates because of that sometimes.

        For now, it seems to me that when choosing a template, you choose how your informations will be printed AND which form you want to fill...

        But maybe there is something i don’t understand with modx revo, and there is a way to bind different set of TVs with the same template ?

        edit : i know that TV means "Template Variable" wich means that this is probably how modx revo is designed, but i just wonder if this is the best way to provide customs forms for Modx revo ...
          [url=http://www.savepoint.fr/index.php?id=38] -petits tuyaux pour les d
        • - TV allows you to build custom forms, with fields you need to save in BDD values that you want to print or filter with getResources.

          getResources is similar to Ditto and therefore only get Resources (Documents).
          You can then filter resources by TV for example when you use a TV for tagging:
          - you create a TV for the tags which can be attached to any template,
          - A snippet for the landing page to get the passed tag value
          - A landing page with getResources and the TV filter

          Then the output of the results depend on your getResources chunk template, who are not related to either the template nor the TV.

          - But you have to bind them to a specific template, you cannot build several custom forms that will be outputed in front-end with the same template. Am i wrong ?

          That leads me to create a new template when i want a new form, even if those two custom forms could use the same template in front-end

          For now, it seems to me that when choosing a template, you choose how your informations will be printed AND which form you want to fill...

          I’m pretty sure that you don’t have the right approach but don’t know how to explain it, maybe if someone more pedagogic can enlighten you...


          But maybe there is something i don’t understand with modx revo, and there is a way to bind different set of TVs with the same template ?

          When you create a TV, you can tell which Template will have access to it.
          You can create several TVs all attached to the same template(s).
          • Template Variables are simply that, variables for your Templates. They wouldn’t make any sense without the relationship to Templates. But Template Variables have nothing to do with building HTML forms; these are not free-form data fields, they are fields for varying the presentation of pages using a specific Template or sharing common fields across multiple Templates.
              • 21946
              • 283 Posts
              @lossendae Yes i kwow about how TVs can be attached to a template

              "I’m pretty sure that you don’t have the right approach"

              Yes maybe grin

              @opengeek et lossendae

              I love content types in Drupal (custom forms), but i guess modx can’t implement really a "content type" since you have to put yourself all variables in a template to see them appears on front-end. So you have to bind a form to a template ...

              In drupal two different customs forms (edit : i mean value saved in BDD by thoses forms) can be printed by the same template, and that seems to be impossible with Modx.

              I’m a little confused about this dependency between a form (collection of TV binded to a certain template) and a template. Need to think more about that grin

              EDIT : when i say that forms can be printed, i mean VALUES of the form that have been stored in database, not html form itself, sorry for this bad explanation !
                [url=http://www.savepoint.fr/index.php?id=38] -petits tuyaux pour les d
                • 31471
                • 206 Posts
                Quote from: nyl at Jul 14, 2010, 04:28 PM

                In drupal two different customs forms (edit : i mean value saved in BDD by thoses forms) can be printed by the same template, and that seems to be impossible with Modx.

                Sorry, but did you ever try to put more TV placeholders on a single template?
                [tt]<p>TV-1 is [[*tplvar-1]]</p>
                <p>TV-2 is [[*tplvar-2]]</p>
                <p>TV-3 is [[*tplvar-3]]</p>[/tt]

                You can tie any number of TVs to any number of templates.
                • You can’t bind a form to a template in MODx.

                  You can have template variable used in a form, which can be used in the template of your choice.

                  You can also use a dedicated form snippet without any TV to acheive the same goal.

                  Maybe what your looking for is more on the side of formit + a form generator/management.

                  In drupal two different customs forms (edit : i mean value saved in BDD by thoses forms) can be printed by the same template, and that seems to be impossible with Modx.

                  Can you provide a more real world example so i can have a more conrete picture of your issue ?

                  I’m pretty sure it’s possible to do what you want with MODx but not with the Drupal logic.
                    • 21946
                    • 283 Posts
                    @vhollo

                    My head is somehow "drupalized" because of my work.

                    Yes, i know how to print TVs and that TVs can be bind to several templates. I was trying to do the opposite : bind differents collections of TV to only one template.

                    In drupal, forms and templates are two distinct process, and no matters which template is tied to which content type (custom form to save values to database). Values and custom fields are tied to a "content type" wich is only a form and no more than that. Even if no template exists, it is able to store values in database. (well, it is what a form is supposed to do isn’it ? )

                    When you change a template for document in Modx, it ERASES values of your TV. In my head, values saved in database should not be dependant of the template you choose to show them to user ...



                      [url=http://www.savepoint.fr/index.php?id=38] -petits tuyaux pour les d

                    • When you change a template for document in Modx, it ERASES values of your TV. In my head, values saved in database should not be dependant of the template you choose to show them to user ...

                      If you don’t erase it manually it will not be erased.
                      If you change the template, you only have to allow it to access your TVs.