Storing Repeatable Data
I'm looking for a way to store data which is easily accessible (within, say, a custom block) but displayed in different formats across many pages / page templates / blocks. An example would be staff, testimonials, case studies, portfolio, etc. Basically, entering the data once instead of across all pages whenever something changes.
What is the best way to do this? After a while browsing it seems that either's either via. pages (i.e. top-level Testimonials page - loop through child pages attributes) or setting up a custom page type. For both, exclude from sitemap, nav, etc. Is there an example of this / better solution?
I'd imagine that this is a fairly common hurdle so apologies if the answer is already in the forum (I have looked). It's quite easy to do this kind of thing within other CMSs. For example in Wordpress you would create a non-public post type and use wp_query to fetch data.
If it's customer quotes you need, but these aren't really pages anywhere but you want to use them on different parts of pages, you could make a backend/dashboard module for that. This way you can manage them using a specific Add-On you made and they are not pages as you don't want them to be.
You could also use a Block (type) and look for this block on a particular page (in a specific area). Depends on what you want to do with the data in this case, because outputting the exact same HTML is easiest, where grabbing data is a bit harder in this situation.
In addition to what ramonleenders said, there is a free add-on in the marketplace that does what you describe and can be used to learn from.
Simple Testimonials by edbeeny:
Customer quotes was just an example. Ideally I'd like the freedom to design layouts without the worry of whether an Add-On exists, and whether I can control its back-end options and front-end markup.
Is there a standardised way to grab arbitrary, non-public(non-indexed) data from the database which a client can add to, edit, what have you from the back-end and I can display however I wish on the front-end? Is there a standard, documented method? I was hoping there'd be a single, definitive answer. Again, like wp_query. ATM it seems that everything C5 does relies upon either an Add-On or hacking an Add-On rather than using core methods.