ernst
November 22, 2019, 2:56pm
1
How does the Panel work with snippets?
Given that I have a footer.php snippet located in /site/snippets/ that has text and links.
How do I add this in the Panel so that I can change the text in the footer at once for all pages (500+).
What would be a good structure?
1 Like
texnixe
November 22, 2019, 3:20pm
3
I’d do this, or maybe you already have a contact page? Depends on the data you use in the snippet.
ernst
November 22, 2019, 3:44pm
4
Thank you Adam and Texnixe for helping me out!
I’ve set up the following file:
site.yml contains:
title: Site
columns:
- width: 1/2
fields:
footer-text:
label: footer-text
type: text
footer-text-1:
label: footer-text-1
type: text
So footer-text
does give back the content as a label, but it’s not editable (obviously). The content is in a language file /site/languages/en.php
.
What would be a good strategy for moving the content from the php
file to a text file so that is editable?
In the root of content add site.txt and put the content there? I’m not sure if I can still use the ‘snippet’ on other page(s).
texnixe
November 22, 2019, 3:46pm
5
There’s a problem with your blueprint, you can’t use dashes in field names, use camelCase or underscores. That’s why it is not editable.
This is completely independent. The contend lives in the content files and is edited via the Panel. In your templates and snippets, you just fetch the code from the content files.