-
- 135 Posts
Hi guys, I’m double posting here in hope of getting a ersponse today, was trying a variation of the sidebar content control using checkboxes for my current project but couldn’t figure it out. Here’s the scenario:
I have a monthly magazine site and each issue has three main tv’s that control the display of the master template and article listings, they are:
» templatePath i.e "assets/templates/april2006"
» articleID i.e. "38" doc ID of folder containing articles for the issue, this is used by Newslister and Dropmenu for listing and navigation
» regularID i.e. "50" same as above
What I am wanting to do is use a single master TV called issueMeta to control all three of those values by using a checkbox widget containing April 2006, May 2006 etc. checkboxes so that in parent folders I just tick the correct issue and the three other variables get set accordingly.
The trouble I was having was adding multiple values to a single checkbox set, it differs from the example since simple chunk names were used, I also got stuck when trying to figure out a way to set other template variables based on the issueMeta master set, so how do I add an array as a checkbox value and how do I process the returned array to set other TV’s to the correct values?
Please help! P.S. If possible I don’t want to set three master checkbox TV’s i.e. one for templatePath, articleID and regularID. I also can’t use what I term a global value because I have back issues available and the variable values are issue dependent.
Thanks in advance.
-
- 7,075 Posts
I have had problems, with mutiple checkbox but in my case with the NewsListing snippet as you can see here :
http://modxcms.com/forums/index.php/topic,1235.msg18124.html#msg18124
I don’t know if it has any relation to your problem, but I thought I’d mention it. Other than that, I can’t help you there, well beyond my skillset...
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id
-
- 135 Posts
Hi, thanks for the response, it’s not quite in line with what I’m trying to accomplish but thanks anyway. If I could figure out a way to pass an array as the checkbox value that would be the first step in getting it working, any ideas flaoting around out there?
-
- 239 Posts
If I understand correctly you want to only set one option instead of 3 options. This is how I would do it (I think):
I would create a TV with input type "Drop down list menu". This way a user can only select one value and you don’t get a whole page full of checkboxes or radiobuttons. For the values in this TV you could do something like "April 2006==assets/templates/april2006,38,51||March 2006==assets/templates/march2006,82,21||etc..."
This way the user can select April 2006 and the TV value would be "assets/templates/april2006,38,51".
Next I would write a snippet or plugin that reads the value of the TV for the current document and splits it in 3 parts by using the comma seperator that I chose. Then the snippet or plugin could setup some placeholders with the split values. You can then use the placeholders in the document. Although I am not sure if placeholders can be used to pass parameters to a snippet (hmmm, that could be a problem).
Note to make maintaining the TV easier you could get the values for the TV from a chunck or document with @bindings so you have more room to type the values and keep a better overview.
/disclaimer - This is a first thought there might be better/easier ways and the placeholder might be a problem when it is not possible to pass it to snippets.