Hi there,
I have an existing website that generates a footer based on the titles of the pages in the footer. The pages in the footer are not related by hierarchy in any way so I can't use the Menu() template control. Let's the say the footer looks like:
HOME | CONTACT US | DIRECTORY | LOCATIONS | RESOURCES | ABOUT US | EMPLOYEE AREA
I know I can use the Page control in the template like:
<% control Page('home') %>$Title<% end_control %> | .... | <% control Page('employee') %>$Title<% end_control %>
but I'd rather hide the logic in the class so I can output the footer like this:
$Footer
What do you recommend? How can I access the contents (eg, title, menu title) of pages within a class using a method in the controller:
method Footer() {
$footer = '';
$footer_files = array('home', ...., 'employee');
foreach ($footer_files as $file) {
// read the contents of each file here;
$footer = ...?
}
return $footer;
}
(as background info, the site is currently running on MODx where we used the Ditto and WayFinder snippet to generate the footer. It's basically just a file content reader that you pass a list of page ids to that you want to read content of fields from. We want to be able to duplicate this functionality in SilverStripe)
thanks!
Steve