How to define a content function or snippet
PermalinkLet's say that each page needs a footer. I want to define the content in the footer as a function or snippet, say footer().
Then I add the function to each page. Then, when the footer changes, I simply go and edit the content of the function, and the whole website is updated.
The scrapbook allows me to add the html easily, but it does not allow a site-wide update. Each footer has to be updated one by one.
How do I get around this?
Kind regards,
wickyd

1. Go to Dashboard -> Scrapbook. Create a new scrapbook...call it whatever you want (I usually call mine Global).
2. You can either add the block directly to that scrapbook from that page OR go to a page in the site that already has the block you want, and copy it to the newly created scrapbook from there.
Once you do that, anytime you add the block to a page from the scrapbook, you will be adding the centralized "global" one.
default.php includes:
/elements/header.php and
/elements/footer.php
so if you edit the footer it changes it on all pages
This answer is perfect, thank you.
This can even be taken a step further, by adding the content block to default.php.
Then when a new page is added, it already has the footer block defined and picks up the content from the scrapbook.