I have recently added a sidebar to my website, all of the content is populated by calling chunks. Instead of having a separate chunk per page, to call other chunks, is it possible to have the chunk enabled by the use of TV’s?
This is probably confusing at the moment, but I have chunks such as {{sidebar_home}} and {{sidebar_pageX}}, inside those I have calls to other chunks, {{static}}, {{link2}} and such.
What I am thinking, a way to have all the sidebar elements linked to a TV multi select box. This way elements can be enabled or disabled per page without having multiple sidebar chunks to manage. This would also ease on the template editing.
Thanks!
-
☆ A M B ☆
- 24,524 Posts
I always use TVs for those, the TV is a textarea type, and contains my chunk tags and any other tags or HTML I want in that block. Usually I use @INHERIT binding so each section will get its own values by setting only the parent document’s values.
-
☆ A M B ☆
- 24,524 Posts
The select TV thing has been done for a long time, there should be several discussions of how it’s done on the forums.
And there’s this
http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks
If I can get around to it, I plan on doing an update on ’Create_TV_Based_Chunks’. I am going to pull articles from a certain parent and use @DOCUMENT bindings to show them. (I dont want clients to have to know what a chunk is)
Ahh, that looks a bit cleaner and easier to manage than my mediocre implementation.
Thanks for the link!
---
I have added the required code and I must say this is rather elegant.
Excellent
Thanks
Susan,
Have you gotten the tv_chunks to work with @INHERIT. It wasnt working for me when I tried it.
-
☆ A M B ☆
- 24,524 Posts
No, I’ve actually never used that; I’m a command-line type of person and prefer to enter my values by hand.