I’m working on a site which like many other sites has a footer which consists of a menu and some other content.
For now this footer is static in the HTML of the page template, but I would like this to be editable by the users.
I tried to do this by creating a footer region in the page template and then use a layout with some text components and parts.
The problem is that this new dynamic footer is not shared for all pages (landing-page content-type) that uses the page template. Only new pages get the footer created from the region and later updates to the footer requires creation of new pages to be visible.
This behavior kind of defeats the point of the page template region. It is actually more flexible to just have the footer static in HTML since it is just one place to edit for all pages.
It seems like the markup for the page template is copied when creating a new page so later changes done to the page template in dynamic regions never becomes a part of exsiting pages.
I would think the expected behavior for most people would be that all pages using that page template would be updated with the latest changes to the page template.
I read somewhere here about Fragment. Are they meant to address this issue or do you have some other way of fixing this?
Or am I doing it all wrong?
You are not wrong - but you’re looking for functionality not yet implemented.
It is not yet possible only to overwrite a single region on a page. If you start customizing pages everything is copied from the page template and into the page at hand. Also, you would need to define the footer for every page template
Fragments (as you have read about) will probably be an interesting solution, as you will then be able to save and reuse configured components as content (across pages)
For now, your best shot is defining the footer as a content type - and fetching it by path into your page code…
As Thomas just said you’re looking for the coming feature Fragments.
But another solution to your footer problem is to define this data in your config in module.xml (or site.xml in 6.0). This way you edit this data on your Site in admin and can add text and other data. This data is updated and fetched from one place with portal.getSite (from this path: “data.moduleConfig.config”). Place that code in your Page Template. So every page using the same code source will have identical footers.
I have a working example with social network buttons and address vcard if you need? Just have to upload it somewhere first.
Bobby’s solution sounds like the best option. Define all your footer configuration inputs in site.xml, but I would suggest retrieving the configuration with site.moduleConfigs[module.name] instead of the site.data.moduleConfig.config. Otherwise the config would turn into an array and break the site if a second module were to be added.
@bwe you should update any of your apps that are using data.moduleConfig.config. I’ve talked to Thomas about changing the data.moduleConfig for 6.0 so that it only returns the config for its own app. There are probably lots of people in for a rude awakening one day when they add another app to a site and it breaks.