We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25803 ☆ A M B ☆
    • 721 Posts
    Quote from: garryn at Mar 29, 2010, 04:53 PM

    Quote from: sottwell at Mar 29, 2010, 12:29 PM
    How are you handling the assignment of the TVs to their respective templates? I just added this to SkinGraft, but that’s only with one template being installed ...
    Well, you can see how the TVs are handled in the installer by viewing this changeset.

    Basically, the TV definition file (placed in the /install/assets/tvs/ folder) would look like this (note, some of my values are sheer gobblydegook) :
    /**
     * My Test TV
     * 
     * My Description for my TV
     *
     * @category        tv
     * @name            testTV
     * @internal        @caption My Test TV
     * @internal        @input_type richtext
     * @internal        @input_options x==1||y==2
     * @internal        @input_default x
     * @internal        @output_widget datagrid
     * @internal        @output_widget_params x=1&y=2&z=3
     * @internal        @lock_tv 1
     * @internal        @template_assignments MODxHost
     * @internal        @modx_category Test
     */
    


    A comma-separated list of @template_assignments would assign that TV to each of those templates.

    Excellent. How do we find out the name of the input types? For example I want to install a number of TVs we use for blogging. One allows the user to select how many recent articles are shown:

    /**
     * Articles Summary
     * 
     * Summary Count for Articles
     *
     * @category        tv
     * @name            articlesummaries
     * @internal        @caption Article Summaries
     * @internal        @description How Many Articles Summaries Per Page?
     * @internal        @input_type drop 
     * @internal        @input_options 1||2||3||4||5||6||7||8||9||10||11||12||13||14||15||16||17||18||19||20
     * @internal        @input_default 3
     * @internal        @output_widget 
     * @internal        @output_widget_params
     * @internal        @lock_tv
     * @internal        @template_assignments blog-index,Blog,Video Blog
     * @internal        @modx_category Ditto
     */


    This is a drop down list menu. But what is the name of that input type for this? It’s probably not drop as indicated below. Is there documentation about what each list type is called?

     * @internal        @input_type drop 


    Also I added this:

     * @internal        @description How Many Articles Summaries Per Page?


    As it was not in your original description. Is that valid as well? We have about 30 TVs to create in this manner so we want to get it right.
      • 25663 MODX Staff
      • 12,272 Posts
      (admin note: split from another thread)
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 25803 ☆ A M B ☆
        • 721 Posts
        Quote from: rthrash at Apr 06, 2010, 10:22 PM

        (admin note: split from another thread)

        Thanks Ryan. This would be useful information to have to take advantage of this fabulous feature.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Probably the best source for information in which is what would be the manager/includes/tmplvars*.php files; there are three of them.

          tmplvars.inc.php handles basic TV stuff, like making the fields. This is the one you are interested in; it has a switch() statement where you can find all of the input types.

          tmplvars.commands.inc.php handles @ bindings.

          tmplvars.format.inc.php handles the output widgets.

          Unfortunately the mutate_content.dynamic.php file is mixed HTML and PHP, with the TV fields for the template being generated on the fly, so you can’t use a plugin with the OnDocFormPrerender event to create custom TVs. While you can use snippets to provide custom output widgets, there is no way to have custom input types without hacking the tmplvars.inc.php file.
            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
            • 10487 MODX Staff
            • 1,535 Posts
            Input Types

            The input types that can be used are:

            • text: Text
            • textarea: Textarea
            • textareamini: Textarea (Mini)
            • richtext: RichText
            • dropdown: DropDown List Menu
            • listbox: Listbox (Single-Select)
            • listbox-multiple: Listbox (Multi-Select)
            • option: Radio Options
            • checkbox: Check Box
            • image: Image
            • file: File
            • url: URL
            • email: Email
            • number: Number
            • date: Date

            Output Widgets

            The possible output widgets are:

            Widgets


            • datagrid: Data Grid
            • floater: Floater
            • marquee: Marquee
            • richtext: RichText
            • ticker: Ticker
            • viewport: View Port

            Formats


            • htmlentities: HTML Entities
            • date: Date Formatter
            • unixtime: Unixtime
            • delim: Delimited List
            • htmltag: HTML Generic Tag
            • hyperlink: Hyperlink
            • image: Image
            • string: String Formatter

            Description
            Also I added this:
            * @internal        @description How Many Articles Summaries Per Page?

            That is unneeded, as the description is pulled from the top part of the docblock (the line below the title of the TV), so in your example, the description would be set to:
            Summary Count for Articles

              Garry Nutting
              Senior Developer
              MODX, LLC

              Email: [email protected]
              Twitter: @garryn
              Web: modx.com
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I am in the middle of an email exchange with somebody who just managed to get the "file" input type to point the resource browser to the assets/flash folder; I haven’t gotten his response to my plea for the explanation of how he did it.
                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
                • 25803 ☆ A M B ☆
                • 721 Posts
                Thanks for the info. I will proceed to redefine our standard base install without the need for a base database. Great stuff!
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  All he did was change the "type" designation in the javascript for the Files case in the tmplvars.inc.php file. I’ve posted an improvement in Jira for two simple changes to add a "flash" input type for TVs.
                    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
                    • 26575
                    • 57 Posts
                    hey. i have some trouble with my tv file during the install...

                    /**
                     * meta-robots
                     * 
                     * Robots
                     *
                     * @category        tv
                     * @name            meta-robots
                     * @internal        @caption Meta Robots
                     * @internal        @input_type dropdown
                     * @internal        @input_options index,follow||noindex,follow||noindex,nofollow||index,nofollow
                     * @internal        @input_default index,follow
                     * @internal        @template_assignments standardTpl
                     * @internal        @modx_category Meta
                     */


                    Error Msg:
                    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’’index,follow||noindex,follow||noindex,nofollow||index,nofollow’,’’,’’,’index,fo’ at line 1

                    any hints?
                      christian seel - www.christianseel.com
                      web developer & designer at chsmedien.de
                      twitter: @christianseel / @chsmedien
                      • 25803 ☆ A M B ☆
                      • 721 Posts
                      Quote from: Seel-Media at Apr 13, 2010, 02:36 PM

                      hey. i have some trouble with my tv file during the install...

                      /**
                       * meta-robots
                       * 
                       * Robots
                       *
                       * @category        tv
                       * @name            meta-robots
                       * @internal        @caption Meta Robots
                       * @internal        @input_type dropdown
                       * @internal        @input_options index,follow||noindex,follow||noindex,nofollow||index,nofollow
                       * @internal        @input_default index,follow
                       * @internal        @template_assignments standardTpl
                       * @internal        @modx_category Meta
                       */


                      Error Msg:
                      You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’’index,follow||noindex,follow||noindex,nofollow||index,nofollow’,’’,’’,’index,fo’ at line 1

                      any hints?


                      I have a similar error though it’s not as specific, it simply ends on "to use."
                      Has anyone successfully been able to use TVs on an install?