tvs0Welcome to Part 6 of the MODx Revolution for Complete Beginners series.  In the last installment, we explored the concept of chunks. We created a number of chunks and learned how to use them to organize our template. We also mentioned a few other uses of chunks and learned their tag syntax and how to call them into the template.  In this installment, we’re going to explore one of the cool features of MODx – Template Variables (TVs).

Catch up:

Part 1: Introduction
Part 2: Installation
Part 3: Basic Configuration and Installing Extras
Part 4: Working with Templates
Part 5: Working with Chunks

As we work through this series, we’re building a resource website for learning MODx Revolution.  In the past couple of installments we’ve started the process of porting a template that we obtained from Themeforest into our MODx website and in the process we’ve learned the basics of working with templates and chunks.  Our website so far looks pretty good, but it’s still a dummy site in the sense that none of the content is our content, and none of it really belongs to the website, but rather it’s all embedded in the template.

In today’s installment, we’re going to start the process of replacing that dummy static content with dynamic content that’s coming out of our website pages rather than from the template.

Working with Content in MODx Revolution

If we look at the content area of our website template you can see three regions that have distinctly separate content in them.

tvs1

My goal is that by the end of this installment we will replace the content in those three regions with content that we enter in the home page in the resource tab, rather than content that is statically embedded in the template.  In the process of doing this we will begin learning the basics of template variables, so let’s dive in 🙂

Creating Content in MODx Revolution

Let’s start by taking a look at a basic resource in MODx Revolution. If you go into the resource tab and open the Home resource for editing, you’re presented with several fields. We briefly looked at this in Part 4 when we assigned the Home resource a template.  Let’s look at it again (remember you can click on the image for a larger view):

MODX Revolution template variables

As you can see from this image, you have, by default, several inbuilt fields available to you.  There are also more fields available under the Settings tab:

MODX Revolution template variables

Each field has a hint that tells you what it’s template tag is as well as a brief description (for most of them) of the field. You can see these hints by hovering briefly over the field:

MODX Revolution template variables

You can fill all these fields whenever you create a new resource, or just some of them, depending on your needs. You can then access the fields you’ve filled using the appropriate template tag. For example you could choose to use the description field for meta descriptions, and then call that field in the meta description tag in the head of your template, and so on. You will see that the Menu title field is important when we come to working with Wayfinder for creating site navigation (coming soon 🙂 )

As you can see, the default resource provides us with one main content field.

MODX Revolution template variables

It is reasonable to deduce that this is where we, or the website editor will type in the main content that they want to appear on the site. We access the content typed in here by using the [[*content]] tag.  In a simply laid out page with just one main area of content, this would be straightforward. For example if we look at the About page that comes with the template we’re working with, we can see that there is only one main content area:

tvs5

Now for our home page template, we could choose to hard code those three areas into the content area by copying the html code into our resource.  However, it makes more sense to me to make those three areas independent, by having each of them have its own content area.  We accomplish this by using template variables.

What are Template Variables (TVs)?

Template variables are simply custom fields that you add to your template.  They are specific to the template you assign the to and will not be applied to any other templates unless you assign them to those templates.  They allow you to have lots of flexibility and to go beyond the supplied fields in the default resource.

Template variables, because they’re simply fields added to your resource, have the same tag syntax as the default fields: [[*TVName]].

TVs have input and output types that extend beyond simple text fields. They can be rich text regions, image fields, url fields, date fields, etc. You can even create custom TV types.  But let’s not get ahead of ourselves.  We’re going to touch on just the very basics in this post, and I encourage you to read more about TVs in the links at the end of this post. In future tutorials we will explore more on TVs because they’re quite powerful and flexible, but for now let’s play with the basics.

The best way to learn of course, is hands on.

We are going to use the main resource content field for area 1 in our template (see the first figure in this installment).  We will then create two TVs for the other two content areas 2 and 3.  Let’s first populate the region 1 with content so that we can track what we’re doing.

For reference, these are the regions again:

tvs1

Open the template for editing and scroll down to find where the code and content in region 1 appears. You can also use Firebug for this.  In my case, it looks something like this:

<div class="special widget_text">
		<div class="sp_title_m">
			<div class="sp_title_l">
				<div class="sp_title_r">
					<h3 class="special_title">Theme Features</h3>
				</div>
			</div>
		</div>
		<div class="textwidget">
			<p><span class="dropcap">S</span>earch Engine Optimisation has been made a priority when designing the <em>Business Success</em> theme. In the code hierarchy, the main content block is placed before the
				sidebar regardless of the sidebar position, so it is crawled first by search engines.</p>
			<div style="float:left;width:50%;">
				<ul class="list-2">
					<li>SEO Friendly</li>
					<li>Easy to Customize</li>
					<li>Typography Styles</li>
					<li>Left/Right Sidebars</li>
				</ul>
			</div>
			<div style="float:left;width:50%;">
				<ul class="list-2">
					<li>2D or 3D Layout</li>
					<li>Unobtrusive Menu</li>
					<li>PSDs for All 7 Styles</li>
					<li>Cross browser support</li>
				</ul>
			</div>
			<div class="clear"></div>
		</div>
	</div>

If I now edit this so that I can replace the static content with my content tag, my code will look like this:

<div class="special widget_text">
		<div class="sp_title_m">
			<div class="sp_title_l">
				<div class="sp_title_r">
					<h3 class="special_title">Theme Features</h3>
				</div>
			</div>
		</div>
		<div class="textwidget">
			[[*content]]
		</div>
	</div>

And now my page looks like this:

tvs7

You can now see that region 1 is empty.  This is because there’s no content in our Home resource content field. So let’s put some content in there.  Open the Home resource for editing and add some content of your choice:

MODX Revolution template variables

Save the home resource and then let’s preview our site.  The text we entered in the main resource field is now appearing in the content area of region 1.

tvs9

OK, so we have region 1 sorted for now.  Let’s move on to regions 2 and 3.  We want these to be dynamic editable content areas as well.  For this we need to create two new template variables that have a rich text area input field.

Creating Template Variables in MODx Revolution

To create a template variable, go into the Elements tab, and right click on Template Variables to create a new TV.  You can also click on the New TV shortcut icon.

MODX Revolution create a template variableIn the template variable creation screen, there are several tabs where you can enter information about your new TV.  Under the General Information tab, enter the name of the TV as well as a caption.  Try to name your TVs in whichever way will allow you to remember what they’re for.  The caption is important as it will guide the site editor/content creator in knowing what each field represents.

MODX Revolution create template variable

You can also add in a description if you want to.

For now we can skip the Properties tab as we have not yet discussed property sets, and we don’t need them at present.

We next move to the Input Options tab. Because we want the site content editor to be able to use the rich text editor when entering content in this field, we specify that we want the input type to be Rich Text.

MODX Revolution template variables input type

Next we move on to the Output Options tab, and for now we can leave this as it is. However, if you click on the dropdown options you will see several choices (such as Date, String, HTML, etc.) which will give you ideas of how you can use this.  And in future we will have opportunities to explore other output options, but for now leave it as Default.

As I mentioned, there are other input and output types that we will explore as we continue, and you can read up on them in the links provided at the end of this post.

The next step is to specify what templates you want to have access to this TV.  As we mentioned above, TVs are template specific.  To set this go to the Template Access tab and ensure that you select your template from the list provided and then click Save.  In my case:

MODX Revolution template variables

There are two other tabs that we haven’t looked at in that screen, namely Access Permissions and Media Sources.  At this stage in our learning we don’t need to worry about them, but we will revisit them later when we need to.

If we now go back and open the Home resource for editing we will note that we now have a new tab, namely the Template Variables tab.  If we nagivate to this tab we will see that our new rich text field now appears with its caption, in addition to the main content field that comes by default.

We can now add some content to our new field.  In the same way, we can go ahead and create another template variable for region 3.

Duplicating Template Variables

HINT:  If you know that the new TV you’re going to create is going to be very similar to one that you already have in your list, you can shorten the process by using the Duplicate TV option instead of creating a new TV.

This is so in my case as region 2 and 3 are quite similar.  Simply right-click on the TV you wish to duplicate and select Duplicate TV:

MODX Revolution template variables

In the pop-up screen that appears, edit the name of the new TV and select to have values duplicated. Your new TV will have the same template access, caption, input type, output type etc as the original one. You should go into the new TV and edit the caption so it’s relevant to the new TV, and also edit anything else you need to edit.

So now if I open the Home resource for editing and again go into the Template Variables tab, I now see that I have two extra rich content areas as desired, as well as the default content field.

MODX Revolution template variables

So now that we have these two regions available to us (and to our website’s content editor), let’s pull them into the template so that their content can be dynamically parsed into our front page.

We need open the template and look for the code and content in regions 2 and 3 so that we know what to replace with our template tags (again we can use firebug for this).  In my case I have:

<div class="cont_col_1 widget_text">
		<h3 class="cont_col_1_title">B. Success Theme</h3>
		<div class="textwidget">You will be able to choose from 28 different transition effects for the Header Slider. Ligula
			eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient
			montes. Aenean massa. Cum sociis natoque penatibus et magnis.
			<img style="padding-top:10px;" src="assets/templates/7in1/sample-data/b_success_logo_btn.png" width="200" height="92" alt="b-success-logo" />
		</div>
	</div>
</div>
<!-- end cont_col_1 -->
<div id="cont_col_2" class="column_1_of_4">
	<div class="cont_col_2 widget_text">
		<h3 class="cont_col_2_title">WordPress Rocks</h3>
		<div class="textwidget">You will be able to choose from 28 different transition effects for the Header Slider. Ligula
			eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient
			montes. Aenean massa. Cum sociis natoque penatibus et magnis.
			<img style="padding-top:10px;" src="assets/templates/7in1/sample-data/wp_logo_btn.png" width="200" height="92" alt="b-wp-logo" /></div>
	</div>
</div>
<!-- end cont_col_2 -->

which I edit to become:

<div class="cont_col_1 widget_text">
		<h3 class="cont_col_1_title">B. Success Theme</h3>
		<div class="textwidget">
                     [[*home7in1_home_contentregion2]]
		</div>
	</div>
</div>
<!-- end cont_col_1 -->
<div id="cont_col_2" class="column_1_of_4">
	<div class="cont_col_2 widget_text">
		<h3 class="cont_col_2_title">MODx Rocks</h3>
		<div class="textwidget">
                     [[*home7in1_home_contentregion3]]
               </div>
	</div>
</div>
<!-- end cont_col_2 -->

If we now view our home page, we should see that the three regions that started out with static dummy content that was embedded in the template are now pulling content dynamically from our three content fields, two of which are new TVs that we’ve created.

tvs16

For simplicity I did not worry about the columns in the first region or the images in the second and third regions, or some of the special formatting classes.  You can figure those out by looking at the template code and adding the appropriate code and adding the images to your content areas using the rich text editor.

There is no limit to the number of TVs you can add to a template. I will likely go a step further and add three more TVs, one each for the title of each region, so that the titles Theme Features, Success Theme, and MODx Rocks are not static but rather can be entered from the Template variables tab. I could also just decide to use one of the existing fields, e.g. Long title, for one of the titles. It’s really all up to you and how you want to work your template.

There is of course so much more to TVs than I have covered here, these have just been the bare basics.  I encourage you to dive in and explore some more about them, learn their different input and output types, read about custom TV types, and experiment.  We will be running into more and using TVs again and again as we continue with our MODx series, so stay subscribed and keep experimenting 🙂

What’s Next?

So now that things are getting dynamic in our template and we’re coming along well with our site build, I think it’s time to start adding some functional bits and pieces.  In MODx, we add functionality to our site through the use of Snippets. In the next installment we will begin looking at Snippets and go on to make our site rock and roll 🙂

I look forward to your comments, questions, feedback etc. 🙂

More Reading

Template Variables
Template Variable Input Types
Template Variable Output Types

Go to Part 7: Working with MODX Revolution Snippets

About The Author

74 Comments

  1. Awesome stuff Mary, cant wait for that MODx learning website to be finished, awful lot of resources for noobs you got here. Waiting for Snippets tutorial and hoping for Output Filters one too. Thanks a ton!

  2. Thank you so much for this I’ve been trying to figure out the best way to do a portal page for a Revo site I’m working on and this article provided the much needed Eurka moment.

  3. Very clear and helpful. I thought it was time to learn a little more about modx… this seems to be the place. Is it safe to say that template variables are basically the modx equivalent of CCK for Drupal but with the common fields mixed in (content, title, etc.)?

    One of the things I’ve heard a lot regarding modx is how the templating is good. I could easily be wrong, but to me it just seems that it really comes down to a trade off. The modx way seems to be a bottom up approach (static at first, then add dynamic content as you need). But in order to gain the same functionality as Drupal, Joomla, WP… from my view point (which admittedly is only from watching a few vids and tuts!) it seems you’d have to spend the same amount or more time in Modx creating TVs, chunks, etc. and setting them all up to achieve the same level of code sharing that you can get in the other systems. But I think I can see the wisdom of the bottom up approach when you don’t need a lot of dyamic content.

    • J
      Thanks for your comment. While the other CMSs tend to be more plug-and-play, e.g. Drupal modules, WordPress plugins, etc., MODx has more of a framework approach which gives you a lot more flexibility. There are different ways to do things in MODx, and it works really well for lots of dynamic content 🙂 But it does require more of a developer mentality

      mary

      • Thanks Mary. I’ve heard other people saying what you are saying and it makes sence. But from my perspective, it doesn’t sound like the most efficient way to go. I look at modules and plugins as an extended toolbox (kind of like an extended framework) to give me a jump start. I’m not often satisfied w/plug n play. If the addon isn’t close to what I need, I find one that is and adapt it, retheme, etc. In that way, I rarely feel limited. Some addons are poorly coded unfortunately, which can be a problem. But after a while you learn which ones don’t throw html into the bowels of procedural code and you can really get stuff done! But on the other hand, I don’t want to be too close minded. I think it takes building at least a few site in a given cms/app before you can really get a good picture of it. For now, I see modx as at least one good solution… for clients with an existing static site who need a CMS on a limited budget. It does seem like it’s hard to beat on that front.

    • Hi,

      can someone tell me how to achieve the template variable effect in drupal 7?
      I would like to have variable information to each content.

  4. Some good points there J.

    I will offer this (for what its worth): I think part of this discussion comes down to are you needing to build just one site or will you be building several or many sites?

    I build custom sites for some of my clients. I can meet with them and listen to them say “I need this here and that here. Can you do this?” With MODx that is no problem. There is no “how do I bend this template to make this work” issues. There is no “how do I add these client requests” into the pre packaged system that comes with most robust CMS platforms. MODx is different for sure, but the freedom and the many open choices you have to approach things soon becomes MODx’s greatest asset in many ways.

  5. Hi Max, yeah I build lots of sites too. But I couldn’t agree that other CMSs make force you into a paradigm. I regularly use Joomla and WordPress (and Drupal to a lesser extent) to build sites from scratch, or sometimes with templates. Unless I go with a template (which I only offer to to clients as an option to cut costs), everything starts on a site plan level, then moves to photshop mocks. Compltely open ended. Again, I haven’t tried the modx and I could be wrong. But more would be needed to convince me that it is in some way more flexble. Foregive me, I’d like to… but so far I just can’t see it. Perphaps because of the sample data that comes with other CMS (or the templates or just all the newbie sites), people get the impression that there are limitations. But like modx, you can start with a totally clean slate if you really prefer (just delete some code!) although I find having something in place as a starting point saves me a lot of time.

    From where I’m at it (and I could be wrong), it just seems more time consuming to build more then a simple site in modx. It’s hard for me to imagine how he addons plus all the built in parameters for title, etc. that the typical site needs don’t provide a huge head start.

  6. Q- 1.Can we have template variable title read similar like [[+pagetitle]]… what i am trying to do is we have 3 template variables in above example. First variable title is ” Theme Feature” Can I have this populate automatically based on template vairable title i put in new resource document.

    • sintl
      If I understand your question, yes this is possible. You can create whatever template variables you want and their values will popular based on what you enter in that field in the resource. Just be cognizant of the fact that you cannot create a new TV and give it the same name as existing resource fields such as pagetitle, etc.

      Hope this makes sense. If I misunderstood your question please let me know

      mary

  7. Hi Mary, Thanks for explanation. Input helped understand more. apologies I referred it wrong.

    I example above you explained how to create template variable we created # 2 column as following [[*home7in1_home_contentregion2]] …This works perfectly fine as template variable.

    We have following code in B. Success Theme ….. what I am want to do is instead of this code, i could get title directly from template variable. At present there is not title for this template variable in resource document.

    Like for instance to get page title we just put [[+pagetitle]] so is there a way to get this done for template variable? so when I create a new document I put title for column 2 variable that gets to front end without worrying to change the template.

    Thnx
    Sintl

  8. Code did not pass on … just to show what i meant by code removed the tags …… h3 class=”cont_col_1_title” >B. Success Theme< / h3

    • sintl
      Yes, you just need to create a template variable and put it in place of B: Success Theme. So for example, create a TV called [[*home7in1_home_contentregion2_title]]
      and replace < h3 class=”cont_col_1_title” >B. Success Theme< /h3 > with < h3 class=”cont_col_1_title” >[[*home7in1_home_contentregion2_title]]< /h3 >. Make sure you assign this template variable to the home template like we did for the others. Then anything you place in that TV will appear in that area. It’s exactly the same process we followed before.

      Hope this helps
      mary

  9. Many thanks !

    I could not envision this method. Will keep this method in mind.

    Sintl

  10. To achieve the same results, one could surely use chunks. So what more benefit do I get that I would not have got using chunks?

    • Mohodin
      TVs and chunks are two different things. Yes you could achieve the same results here using chunks, same way you could leave all your content in the template and just edit the template instead of using resource fields. The whole idea is to make things more dynamic and to separate presentation from content. If we used chunks for this, then we would be mixing presentation and content, which defeats the purpose of using a CMS.

      TVs are editable from the content creation/editing screen. Chunks are not. TVs allow you to have extra input fields beyond those provided by default. I suppose if you were building a site for just yourself and no one else was ever going to edit the content then you could do it that way since you’d know in which chunk you had put each piece of content. But using TVs this way means that you can hand the site over to the client and when they need to edit content, they don’t have to go digging in chunks or the template, they just fill out the fields in the page. This also protects your markup because no one needs to fiddle with it to change content.

      Hope this makes sense.

      mary

  11. Great tutorial, just what I needed. One quick question: is there a way to display newly created TV’s in the default tab (create/edit page) instead of being in its own tab? Also can we override the default fields (content, title etc), hide them or at least rename them?
    Thanks!

  12. Thank you Mary. Your reply was helpful. To follow it up though, what is the point of ever using chunks since TVs are so robust and flexible?

    • Mohdin
      Like I mentioned before, the two have different purposes. Chunks are mostly for templating purposes. You can use them to separate elements of your template into reusable pieces. They only hold HTML. TVs are used for providing extra editable fields. They both have their uses

      mary

  13. If it were not for this tut, I would have packed it in. Many thanks for your generosity. I can’t seem to use Firebug to edit the template…am I missing something. ? I’m looking at the template code in MODx and can’t see how firebug would help. Any help would be appreciated.

    • John
      Glad you found the tut helpful. Maybe I wasn’t too clear about this. You don’t use firebug to edit your template, it’s simply handy for helping you identify the different regions on your page and the code related to those regions. You can then go into the template edit page in the MODx manager and find the relevant divs or blocks of code you identified using firebug and then edit them there.

      Firebug is a handy way to inspect your page structure and test code changes, but the changes won’t be saved.

      Hope this is clearer, sorry if my wording in the post confused you.

      mary

  14. What a wonderful tutorial up until these installment everything has made sense.

    But your diagrams and what i see are different which is confusing me, basically in your diagram when you click the home page to edit you have a Tab named “Template Variables” between “Page Settings” and “Access Permissions” i do not have this Template Variables Tab, nor do i have the nice pop up editor that shows in the Resource Content Window….

    If anyone help me I would appreciate it.

    Regards
    Steve

    • kingo
      Are you using a site that you yourself have built or did someone else build it?
      mary

      • Good Morning Mary, I am creating my own site using Html/Css i have already created and wish to get up and running in MODx.

        Thanks for the quick reply.

        • hmm, what version of MODx Revolution are you using? The Template Variable tab should appear in all resources unless form customization rules have been applied to hide it. That’s why I was asking if this is a site you’ve created or if someone else created it and may have hidden the tab from view. Let me know what version of Revo you’re using

          mary

          • Thanks Mary,

            Okay being a clever so and so i decided to use the latest beta maybe not a clever move!!

            What i will do is re-install the last stable tested release hopefully everything will make some sense then.

            Out of interest which version are you using in your Tutorials.

            regards
            Steve

          • I’m using 2.0.8-pl, which is the current stable release

  15. Hi Mary – great tutorials. I am enjoying working through them. I have a question however. I have just recently installed the version of MODX you are using for these tutorials – 2.0.9-pl – and I can now see the Template Variables tab as described above. However I still cannot see the rich text editing buttons and options as displayed in your sample pictures. In my own installation it comes up blank and there are no editing tools – bold italic etc – for any ontent I edit in my resource tab. How can I correct this? Thanks

  16. re: the missing Template Variables tab. I had this problem too, until I created a template variable (in the Elements->Template Variables section). It seems that at least one TV needs to exist for the tab to appear in the Resource Editing page.

    hth
    mcalex

  17. What if I want to pull introtext from other Resources into these regions instead?

  18. Mary,

    That looks perfect. Unfortunately, I can’t seem to get it to work. It doesn’t seem to be picking up the content by IDs. I don’t know if it is a permissions issue with resources or what. Weird.

  19. Mary,

    The snippet looks like this (placed directly into the template):

    [[getResourceField? &id=’13’ &field=’introtext’ &default=’Sorry, no data available’]]

    I can display the ‘Sorry, no data available.’ Interestingly, it comes in with the single quote marks.

    It just won’t pull the introtext of Resource with the ID of 13.

    Thanks,

    Matt

    Th

  20. Following up, when I used this in the template instead (note that it is without single quotes):

    [[getResourceField? &id=13 &field=introtext &default=Sorry, no data available]]

    This worked! Still, it seems worrisome to not have single quotes in there. What would cause this behavior?

    • Matt, this is simply because you’re making the common mistake of using single quotes instead of backticks (`). The correct way to make this snippet call is:
      [[getResourceField? &id=`13` &field=`introtext` &default=`Sorry, no data available`]]

      You can obviously get the result correctly without the backticks but it works only because your call is a simple one. Once you start adding things with more than one value per argument and such it would immediately break. This is a common MODX error, using single quotes instead of backticks 🙂

      mary

  21. Ha! Well, that’s embarrassing. Thanks for bearing through that with me, Mary. Excellent tutorials, btw!

    Seriously, I appreciate it.

    -Matt

  22. Hi Mary,
    so far your tutorial has been excellent but I can’t follow here because I don’t see the “template variables” tab.
    I have tried creating a template variable but it still won’t show.
    I’m using version 2.1.5-pl

    I would appreciate any advice on this.

    • Adi

      You need to create at least one template variable for the tab to become visible. I should probably add this to the instructions. Make sure that you’ve assigned the template variable to a template, and then the tab will show when you open a resource that’s assigned to that template.

      mary

      • Wow thanks for such a fast response. It’s fixed now.
        Being the noob I am, I created the template variable but didn’t assign it to the template. As soon as I did that it worked.
        Thanks again 🙂

  23. Thanks mary. I’m getting to like modx now… Excellent tutorial…

  24. Hi Mary – In lesson 4 template variables – Creating content you have a picture a snap shot of resource and I believe the Home resource. In the picture to the right there are 4 categories 1-create/edit document 2- Page Settings 3- template variables 4 – access permission. I only have 3 categories I don’t have template variables to chose from. Do I need to have that up there or do I put it up there some how.

    Thanks

    • Have you read the instructions right above that snapshot in the tutorial?

      “I should mention that based on the comments and my own experimentation after I wrote this tutorial, the Template Variable tab is not visible until after you’ve created a TV and assigned it to a template, so if you don’t see this tab at this moment please don’t worry, keep reading and following the tutorial and the tab will appear once you’ve created at least one TV and assigned it to the template”

  25. Thanks for responding so quickly because I get stuck at times. Here is another problem, after creating a TV I go to the resource and then click on template variable but there is only a box to type in I must have missed a tutorial on rich text editors. I remember awhile back I added one but couldn’t figure out how to get it working.

    Thanks again

    • You have to set the input type to Rich Text

      • I set input type at Rich Text however at the bottom of the screen at the (resource content) the code from my web template is in there and in your screen shot it is empty.

        Also if I go to New template variable to create a template variable mine looks different then yours. Mine has the input and the output along the top with every thing else. Yours is below after (clear cache on save)

        Thanks

  26. I’m having a similar issue to Rocky following this tutorial. I’ve added a TV and set it to RichText then added it to my template, but when I click on the Template Variables tab on my resource, it displays as a textarea instead? Is this a bug perhaps? I’m using MODX Revolution 2.2.0-pl2.

  27. It’s OK, I found the problem. I hadn’t installed the TinyMCE snippet. Once I did that, it showed up as a RichText editor fine.

    The section in part 3 that dealt with installing add-ons didn’t explicitly say to install any particular extra and I guess coming from a cmsms background, I didn’t fully understand that you have to install everything you need in ModX 🙂

    Really enjoying the tutorial, and getting into MODX more and more.

  28. Mark

    If you are talking about downloading the tinymce from the package manager and then installing it I did that and for two days it never worked but today I went to resources and then TV and there it was. But it doesn’t show up under elements and snippets so I don’t understand what you mean by installing the snippet. But it is in the plugin folder. But I also downloaded the elRTE but I don’t know how to choose between the two. That would be nice I wanted to see the difference.

  29. Hi again!
    Hope you are doing great!

    I have been working with modx Evo for quite a while, moved to Rev and everthing is fine. I just tried to set a TV with RichText (input) and still appears as a simple text input field.
    It was the same with Rev 2.0 and now with Rev 2.1.3.
    Can you help me here?… what could be the problem?

    • enio,
      Do you have TinyMCE or another RTE installed and working?

      mary

      • Yes, I have TinyMCE, but not the latest version as I can see. I have the 4.3.0, although Revo doesnt allow to upgrade (for some reason), so I downloaded elRTE, but still the same.
        I noticed that TinyMCE has a new version, but still my version of Revo wont let me see or download this through the backend manager.

  30. Thank you for explaining TVs better than any other tutorials. I only wish ModX manager used tabbed file browsing.

    I want to convert my static site and have many chunk-like php files assembled into pages using ‘include’ statements.

    Where do I put my 100 individual products so they can be assembled into pages as people search for certain features? I want to do it right the first time. thanks and keep up the good work.

    • Several options: You can make each product a resource and then use something like getResources and getField, or you can store them in the database and then pull them in using a custom snippet.

  31. Can you put a chunk or snippet in a template variable?

  32. Hi Mary, thanks for these tutorials. I can’t get this to work. Below is what I have in my template, where as you seem to have the html for the page in yours. [[*content]] being the content in my home resource. I have a region 1 and a sidebar. The sidebar I want to be a TV. So the TV has to be called in the template because it is template specific, where as I am calling it in the home resource content area and it is not appearing? Any help would be appreciated.

    [[$home-header]]

    [[*content]]

    • Martin
      I don’t completely understand your question, and I think wordpress ate some of the code you left in the comment. Can you clarify a bit more what you’re trying to do? What do you mean by calling the TV in the home resource content area?
      You can post your code in pastebin and leave the link here

      mary

  33. Mary, thanks. This is what I’ve done. I have my main page editable content in the resource and my sidebar is a TV which I’m calling into my template. Should I then call more TVs into the sidebar TV? Because I will want different content in the sidebars on different pages. Basically, how would you arrange sidebars that are going to have different content on different pages? Thanks. Martin

  34. So far so good! Once again, thank you Mary, you have a natural ability to explain things clearly without getting bogged down – more please!!!

  35. I really loved your series here- learned everything from your tutorial! thank you! Very well and logically written. Max

  36. Many thanks for your tuto. The way you present things is clear and makes the learning very easy.

  37. I have followed this awesome tutorial so far but when I get to teh TV section, something is not working.

    I get as far as seeing the TV Tab on the resource but this “If we nagivate to this tab we will see that our new rich text field now appears with its caption” does NOT show. Everything else has been pretty spot on otherwise.

  38. Well, it seems that upgrading TinyMCE solved that problem.

    Thanks for the article! Looking forward to reading more!

Leave a Reply to Paul Cancel reply

Close