We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39292
    • 6 Posts
    I have been googling away, trying to find out exactly how to create custom TVs in Evo 1.0.6, and i cant seem to find any documentation anywhere!!

    I've found a few videos that whilst appearing helpful, don't seem to work (they are for 1.0.5 but surely the syntax hasn't completely changed between the two?)

    So, to summarize where my problem lies. I go to create a new TV, set it to input type "custom input" and then I'm attempting to add just a simple text field in to the input option values box, just to test and make sure it works!

    I tried copy and pasting the basic structure of a text box tv from manager/includes/tmplvars.inc.php but that doesn't appear to work, i tried typing out the syntax for the text box from one of the videos i saw (as the syntax in his tmplvars.inc.php is totally different to mine... worrying!) and that also did not work!

    The TV appears under the content box on pages with the assigned template, but the value box has code in it and if i change it, it doesn't save (and also does not display on the page when called) so i have obviously totally messed it up! But without any kind of syntax reference I'm just kind of stabbing in the dark at it right now!

    It doesn't appear to be covered in the documentation either, frustratingly.

    Does anybody know of any reference or perhaps can give me some pointers to get me started?
    Cheers,
    Dan.
      • 19369
      • 1,098 Posts
      Hi, the only difference between Evo 1.0.5 and Evo 1.0.6 is few security fixes.

      You are right, there is not much documentation about Custom TVs, but maybe this is of some help: http://sottwell.com/custom-tvs.html
        • 39292
        • 6 Posts
        Hi microcipcip,

        Yeah, I figured it wouldn't be a huge difference, it just puzzled me that the syntax used in this Introduction to custom TVs in MODx Evolution 1.0.5 video: http://www.youtube.com/watch?v=HFmWFPR8rhU clearly works for him, yet my tmplvars.inc.php file seemingly looks nothing like his, and even if I type out the code he used, it just plain doesn't work for me!

        (EDIT: I think I may have been going soft in the head after hours of googling etc! The tmplvars.inc.php file is infact the same, and the specific markup is at the bottom of it... how embarrassing!)

        Thanks a lot for the link, I'll have a read up and hopefully it'll set me on the right path smiley [ed. note: pulsecode last edited this post 14 years, 5 months ago.]
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Actually, it's amazingly simple. Use @INCLUDE <path-to-file> as the Input Option value of a Custom TV type, and do whatever you want in your .php file. Just make sure that at the top of the file you put in a dummy hidden input field, or MODx will think the TV is blank and will remove it altogether. It's also helpful to find out what output MODx creates for the various types so you can mimic the formats in your own.

          Another "gotcha" I ran into is conflicts with ManagerManager's setup of JQuery; it loads JQuery in no-conflict mode using $j. Perhaps ManagerManager could be improved with a configuration option like QuickManager+ has? Of course, once the entire Manager is converted to JQuery that won't need to be done by any plugin or module or custom TV at all.
            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
            • 39292
            • 6 Posts
            Hi Susan,
            It appears it's amazingly simple if you are a php coder then!
            Exactly the opposite of what I am! (I'm a designer, html and css guy...)
            I don't mean to sound ungrateful for your reply! But "amazingly simple" is rather an objective statement when I was half expecting to be able to do more than one input box per TV without having to actually program it myself!!
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Well, there will eventually be a number of packages available. What do you have in mind?
                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
                • 39292
                • 6 Posts
                Hi, sorry for my grumpy tone by the way! It had been a long and fruitless day!

                Well, what I was trying to achieve was something similar to something the Perch CMS calls repeatable regions. So basically little groups of input boxes that are different parts of a whole, that can be duplicated.

                For example, imagine a box on a page that would require an image, a hyperlink and some text to complete it. Rather than having to have 3 TVs for every instance of that box on a page, I like the idea of having one TV that has those 3 fields in it, that can at the click of a button duplicate those 3 fields.

                The reason being that if you have 4 of those boxes (as I do on a site I'm working on) on a page, the only way I know at the moment would require 12 TVs to supply all of the data, and the site owner couldn't add another one if they wanted... whereas with a custom TV as I described, you would just have the one TV, and the site owner could click to make an additional set of 3 fields to make another box if they wanted.

                I know that's all rather more complicated! But even at the most basic level, being able to have a TV that can have more than one field would be nice.
                  • 19369
                  • 1,098 Posts
                  I am looking for a feature like that myself.
                  There is a plugin that works in a similar way: http://modx.com/extras/package/multigridtv
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    The trick to this is using TVs in the multi-grid TV. Revo does this with MIGx, and "chucktrukk" in his videos of the demo Flikr-based custom TV says he'll follow up with how this is done, but so far I can't find out how to do it! I'm sure it'll be obvious once somebody does tell us how.

                    You would set up an image TV, a text input TV and a textarea or rich text TV. These are bundled together into the custom TV, and you can click a button to get as many of these groups as you like. The data are stored as a JSON object, and your output snippet processes that JSON object.

                    While the three basic TVs are used for input, they themselves perform no other function and never contain any values. All values are gathered up into the custom TV's JSON object.
                      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
                      • 13428 ☆ A M B ☆
                      • 1,031 Posts
                      MultiGridTv is over, long live multiTV.

                      https://github.com/Jako/multiTV