I have a vague idea of how something I want to do with a template would work using TVs, but I’m not sure if I’m on the right track.
I have a basic 2-column layout, with a sidebar to the right. I want to be able to dynamically load blocks into the sidebar. All pages will have a menu block. Some pages will have a login block, some would have a shopping cart block, maybe other blocks depending on the page.
My understanding is that I would create a TV for each block, and connect them all to the template. Then each document that I want to have the given block displayed on would enable and customize the desired TV.
Now, my question is, if I insert all the TVs into the template in the sidebar div, they won’t all show up on all pages? Only on the pages that they are connected to? i.e if the "shopping cart" TV is only enabled in the "Products" document, that’s the only page it will actually be displayed on?
I guess what I’m tryng to determine is if the TV is registered to the template, and positioned where in the template you want it, but it is only enabled in a given document?
As you can see, I’m still having problems wrapping my mind around the concept.
-
- 577 Posts
Just a comment here.
I’ve been working on a template for my site and just have really started to learn more of Modx.
One thing that I did notice was that there are no default TVs in the basic install. This is a shame because I like to look at what is availabe to learn how to do something on my own.
Is there a few general TVs out there that I can download? Or any tha somebody could share? Like a footer, or something simple like that?
Tangent-Warrior
I used a very simple one for my latest (cookie-based) multilanguage system and discussed it here:
http://modxcms.com/forums/index.php/topic,409.0.html
But I found the documentation to be useful; it’s how I got the ideas and how to get started.
Ok, I moved the individual block html out to chunks ( {{MenuBlock}}, etc ) and created a TV:
Variable name: sideblocks
Caption: Sideblocks
Input type: Listbox (multi-select)
Input option values: Menu block=={{MenuBlock}}||...
Gave my template access.
Put [*sideblocks*] in the sidebar div where I want the blocks to show.
The document editor shows the TV, with the selection. I select the MenuBlock option, save the document.
Now what? Nothing is showing. I’m not sure that I understand how this is supposed to work.
-
- 1,732 Posts
Hi Susan,
I’ve just tested it and it works fine! Try retracing your steps or create a simple TV to display some text to see if anything is displayed inside the [*sideblock*]
-
- 109 Posts
Hi Susan,
I was having the same problem.
Solved: the TV names are case sensitive. Sideblock doesn’t = SideBlock
Maybe check case...
Richard
PS: The more you explore the more flexible ModX appears to be! Wicked!
Yeah, I really love it! Even I can make it jump through hoops!
Turned out to be a silly typo in a chunk name (MaainMenu instead of MainMenu). So now it works; I can select what chunks I want in the sidebar for each document.
But now I’ve got another issue. I’ve done something wrong. If you look at the page, you’ll see the || separators for the TV’s Input Option Values
Menu=={{MainMenuSideBlock}}||Calendar=={{CalendersideBlock}}||Login=={{WebLoginSideBlock}}||Search=={{SearchSideBlock}}
are actually being displayed on the page.
http://www.sottwell.com
-
- 1,732 Posts
Hi Susan,
When you select multiple values from a check list or multi-select listbox, those values are stored inside the databe using the || character as a separator.
To display each item separately use the Delimited List Widget abd set it’s Delimiter to