Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Creating pages from the CMS on save and publish


Reply


7 Posts   618 Views

Avatar
njprrogers

Community Member, 23 Posts

10 March 2011 at 6:12am

Edited: 10/03/2011 6:13am

Hi,

I'm an SS newbie so apologies in advance.

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:
Cat 1
- FAQ1
- FAQ2
Cat 2
- FAQ4
- FAQ2
Cat 3
- FAQ5
- FAQ6

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.
Cat 1
- FAQ1
- FAQ2
- FAQ7
Cat 2
- FAQ4
- FAQ2
- FAQ7
Cat 3
- FAQ5
- 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?

Thanks,

Nick

Avatar
honeybunny

Community Member, 79 Posts

11 March 2011 at 1:43am

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.

Example:

<% 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.

HB

Avatar
njprrogers

Community Member, 23 Posts

11 March 2011 at 2:58am

Hi HB,

Not quite... Each FAQ has a page type and a page. When you set up an FAQ page, I want to be able to extend the cms with a list of check boxes where the user can select a category.

So far, so good!

However, when the user ticks a check box and does a save, I want to create multiple pages (one for each category selected).

Thanks,

Nick

Avatar
martimiz

Forum Moderator, 1097 Posts

11 March 2011 at 4:55am

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?

Avatar
njprrogers

Community Member, 23 Posts

11 March 2011 at 5:01am

Hi,

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.

Thanks,

Nick

Avatar
honeybunny

Community Member, 79 Posts

11 March 2011 at 5:21am

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.

Sorry :(
HB

Avatar
njprrogers

Community Member, 23 Posts

11 March 2011 at 5:32am

If the DataObjectManager could handling re-ordering pages, it would work. I'm not sure that that is the case though...

These FAQ's are definitely pages...