Where to store custom block templates so they don't break every upgrade?

Permalink
I have several custom templates for core blocks, e.g. "next_previous".

Whenever I upgrade C5, those templates are lost - obviously, because C5 uses upgraded blocks in a new directory.

I can manually copy them from the old block directory to the new one, but is there a way to store them in a location that doesn't break in the first place?

pekka
 
Cahueya replied on at Permalink Reply
Hi pekka,

Just place them in the root directory folders, they should not be affected by upgrades then.

So for the "next_previous"-block this is:

ORGINIAL:
/concrete/blocks/next_previous

COPY TO:
/blocks/next_previous

If you want to maintain the original template, go:
/blocks/next_previous/template/your_templatename


Kind regards
pekka replied on at Permalink Reply
pekka
That's a viable option, thanks.

I don't suppose there is a way to have the blocks upgrade automatically, but to use the custom templates stored in another location?
Cahueya replied on at Permalink Best Answer Reply
Thats the last option described.

The blocks' original files are either in
/concrete/blocks/blockname (for core blocks)

or
/packages/packagename/blocks/blockname (for marketplace add-ons)

if you put your custom templates in
/blocks/blockname/templates/your_template

they will never be affected by the update process of the blocks original files and will always work unless the update was a major change that needs a totally different view.php or different classes.

Concrete5 is having a great system with these overrides.

So, no matter if a block is part of the core, a package or a theme (package), putting the template into the root folder will leave the template untouched.
pekka replied on at Permalink Reply
pekka
That's great, didn't realize that. Thanks!