Hi Swaiba - I've started to think about the front end output and wanted to get your input on what I am thinking so far.
To back up a step here are the general functionality requirements:
1. A testimonial will appear in the header of every page (except the home page)
2. Each page will actually be assigned a group or groups of testimonials to rotate through. I haven't decided if rotate is on page load or fadein/fadeout while you are on the page. Either way I will need a random testimonial loaded from a specific group or groups.
3. Any page not assigned a specific group or groups, will pull from a couple default groups.
Here are some general thoughts so far:
1. I am going to need some sort of function to get the testimonials from the database:
function getTestimonials() {
$testmonials = DataObject::get("Testimonial");
return $testmonials;
}
2. I think I have decided I should use a big if/else statement to control the page dependent output. Maybe something like this:
<% if URLSegment = my-url-segment %>
<% else_if URLSegment = myother-url-segment %>
<% else %>
<% end_if %>
I'm guessing this would be the best approach for new pages that get created that aren't assigned to a group of testimonials. Although for children pages that all pull from the same group(s) maybe I need to use something like "if in section" ...so I'm not spelling out everything single child page.
3. For outputting the testimonial content maybe something like this would go in the if statements:
<% control getTestimonials %>
<div>$Quote<br />$Signature</div>
<% end_control %>
..but I need to add in a category filter somewhere. And actually the above would just give me list, while I need to only show one at a time. Not sure if random would happen at this level or the function level. And maybe the category filter needs to happen at the function level too.
As always, any suggestions would be great. Thanks again!