Please forgive me... I really have tried... Read the documentation, faq, and tutorials (much of which added to rather than relieved my confusion)... done a bunch of forum searches... I just don’t get Template Variables. I think I’ve groked chuncks and snippets but TVs are completely eluding me.
How have the rest of you managed to figure this out? Is there a rosetta stone somewhere that I have just managed to avoid so far? Do I need to resort to trial and error? Is it obvious and I’m just stupid (most likely :’()
Any help would be appreciated but most appreciated if given in plain, non-MODx, language.
Thanks in advance!
joe
[SOLVED]... see my later post.
Thanks ajayre & rthrash
I really enjoyed the fact that both of you began your explanations with "TVs are simply..." and "TVs are nothing more than...". I’m looking forward to the time when it all clicks for me.
I really do appreciate the explanations you have given!
joe
Ok, I get it now, at least the fundamentals
It would be most helpful to add something to either the Editing and Creating Documents section of the documentation, the wiki, or FAQ regarding TVs.
For instance...
Each editable characteristic of your document is captured and stored in what is called a Template Variable or TV for short. For instance, the standard content field that you edit is stored in a Template Variable called [*content*] and the page Title is stored in a Template Variable called [*pagetitle*].
In addition to the standard editable page attributes and content, the site developer may define a wide variety of custom elements. The developer can define the editing mechanism (like Rich Text), default content, and the display widgit (like option buttons) that will be used. These custom elements, that are associated with a specific set of templates are also stored in Template Variables.
When you are creating or editing a document that has one or more associated custom Template Variable defined, you will be presented with the associated editing mechanism for each of those TVs.
A specific example might help...
Let’s say that the developer has defined an element (Template Variable) that is intended for you, the editor, to capture a Thought-For-The-Day. So, a custom Template Variable has been defined called [*myTFTD*]. The developer specified that the Thought-For-The-Day should be displayed as text and that the editor should be a Rich Text Editor. So, now when you go to edit your page, not only will you be presented with the ability to edit the standard attributes and content, you will also be presented with another rich text edit section that is specifically for sharing your wisdom!
What ever you enter into that Thought-For-The-Day element in the editing process will be stored in the [*myTFTD*] template variable. This variable can be placed (or not) anywhere in either the template (where spcial positioning and formatting can be applied) or directly in your content section and it will display the contents that you entered. Placing the TV in the document is as simple as putting the name of the variable [*myTFTD*] where you want the text (or whatever widgit was defined by the devloper) to show up.
This is just the most fundamental description and use of Template Variables. Programatic access to these variables as well as the wide variety of types, editors, display widgits and parametric definitions allows a broad universe of applications.
Put that boy on the doc team
That’s the kind of info I think we need more of, especially for those of us who haven’t been living and breathing MODx for months and who do not have any or much of a php/mysql background but more of a XHTML/CSS background.
All in all, I think the information is great and better than you might find elsewhere, but often a more practical, concrete example/tutorial would make all the difference in the world between "wow, cool... not really sure what it does or how to do it, but it sure sounds cool," and "now I get it and can think of 10 places to use it right now and now I know how to put it to use."
|
Identity Developments delivers SEO focused web design and web presence services
- it's not about websites, it's about your identity. |
-
MODX Staff
- 12,272 Posts
Joe I think you explanation was absolutely wonderful, and that it should be used (with only a slight bit of factual editing) for helping folks "get" MODx.
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me