We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27330
    • 884 Posts
    Hi all,
    is there any way to control which TVs are visible for editing in the manager according to the container folder?

    for example I have several sections on the site and each has it’s own TVs; right now the user needs to scroll inside all the TVs and find those that needed in that section. What I want to do is that under container named ’cars’ I’ll only see TVs I choose related to cars and not also TV’s related to ’fruits’.

    is that possible?
      • 7231
      • 4,205 Posts
      The flaw in this method is that if the template is the same you end up with several identical copies of the template. You could put all the html in a chunk but that doesn’t seem right.

      The way that I would like to see (in theory, not sure how practical this would be in practice) would be to have general Variables, these variables could then be assigned to documents or to containers individually. To make things easier you would be able to have preset groups of variables that you could apply to documents (or containers), and if you need to add a new variable just edit the preset and all the documents that use that preset would follow the modification. Much like the document group setup works.

      This sounds very flexible to me, free the variable to be used in any document. Sounds good anyway. grin
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 27330
        • 884 Posts
        Well I was trying to avoid having separate template for each site section. I’m afraid that I’ll do some changes in the main template and they won’t appear in the other template. I’m in particular concerned about my <head>content</head>. If there isn’t any simpler way to control TVs display I might just have to go the templates way.

        dev_cw that idea sounds good indeed, but I’m kinda of copy/paste type of man smiley
          • 22303 MODX Staff
          • 10,725 Posts
          Just make your head section a TV that appears on all your templates and problem solved, right?

          And dev_cw, your idea of variables free of template dependency is in development as we speak; it will be known as ResourceElements, and it will allow you to relate just about any kind of element (snippet, chunk, tv, etc.) directly to a resource. This will not be in the initial release of the re-engineered core, but will be one of the first additional features that gets added once a stable release is achieved.
            • 7231
            • 4,205 Posts
            And dev_cw, your idea of variables free of template dependency is in development as we speak; it will be known as ResourceElements, and it will allow you to relate just about any kind of element (snippet, chunk, tv, etc.) directly to a resource. This will not be in the initial release of the re-engineered core, but will be one of the first additional features that gets added once a stable release is achieved.
            Excellent grin
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don&#39;t know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 18436
              • 135 Posts
              This may help with dealing with the head section of each page.

              Instead of adding your html in the actual template definition I used the includeFile snippet linked to various php files in the templates\templatename\ directory. The bonus is you can then code your template using standard php include/partial methodology.

              I agree with dev_cw, just hoping that 0.9.7 will allow more scope to template variables as I’ve had instances were I needed to define "global" template variables that didn’t need to be set on a per page basis.
                • 22303 MODX Staff
                • 10,725 Posts
                Great tip Marschant.

                BTW, you can approximate template variables without the "template scope" as you refer to it, simply using snippets and/or plugins + placeholders. Just create a snippet to include directly in a template that sets a placeholder, or create a plugin that does the same. Then you can use that placeholder just like you would a TV, minus the output widgets and manager input features; but those could be easily managed via a module, a separate protected front-end page, etc.