I have a requirement to implement an FAQ section with complex enough requirements for categorisation. (many to many, cms re-ordering of the faq's etc.).
I'd like explore the possibility of creating multiple pages when the user saves an FAQ page type.
So e.g. we have:
We go to add FAQ7 page underneath CAT1, Select one of the other categories from a checklist, and it will add pages to the site tree.
- FAQ2 - FAQ7
- FAQ6 - FAQ7
Can you give me any pointers as to how this could be achieved? Whereabouts in the page type code this would be placed?
Hi Nick, are you trying to set it up so that the user starts with a list of FAQ's and and can select for each FAQ category page which to include? (Yes, that sounds even more convoluted now that I've said it, but it's early here.)
If yes, then I would set up an includes file for each possible FAQ, then use a checkbox in the page template. The user can input their FAQ category then check the boxes for the appropriate FAQ responses.
<% if Faq1 %>
<% include Faq1 %>
<% end_if %>
I'm sure that there is probably a very clever alternative that can be coded into the controller that will automatically pull the right FAQ response for a given category, but I usually go with the easiest and for me that means working from the actual template. For what it's worth I use this method all the time and it works for me.
I don't think I quite get this, so before thinking up all kinds of convoluted strategies...
When you create FAQ7, are all duplicates supposed to have the same fixed content (like virtual pages)? Or do you want to change content depending on the category, and just have the pages available - possibly with the same urlSegment and MenuTitle and/or content?
Yeah. I think so. Ultimately, the FAQ pages will have the same content but will appear multiple times in the heirarchy. Whether it is the full page or a 'pointer' to the content, I don't mind. I would just like to have the capacity for users to have the capacity to change the order of the FAQ pages through the CMS page admin.
So to answer, the content will be the same in each of the FAQ's. They will just have multiple parents.
If the url for the faq included it's parent category, that would be an advantage but it's not a show stopper.
It should be easy enough (for someone with more php than me), but I guess I'm wondering why. I get the idea of automatically producing a child based on a checkbox, but why would you want to litter the cms or the website by recreating the same pages over and over? (When you said complex I imagined dozens of FAQ being duplicated...)
My best guess is that it has more to do with the user being able to see the content (which isn't visible in the cms) from the checked box than an actual need to reproduce the same page over and over. If that's the case then there has got to be a better way. I would look at the page_elements module or the dataobjectmanager module. I'm not overly familiar with either of them, but Tim and UncleCheese are wicked helpful and it seems like they both provide a framework for drag and drop reordering and/or filtering at the cms level.
I know I am hindering rather than helping, but I am curious about the application.