Storing Repeatable Data

Permalink
Sorry if this is a noob question but it's something I haven't quite got my head around, despite spending some time searching.

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.

 
ramonleenders replied on at Permalink Reply
ramonleenders
Depends on if you want stuff being indexed or not. I can imagine if you have staff, you want a staff detail page. In that case, I would make them pages with attributes, and make a page list to sum them up on other pages you want to display staff members.

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.

Makes sense?
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi simonseddon,

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:
https://www.concrete5.org/marketplace/addons/simple-testimonials/...
ramonleenders replied on at Permalink Reply
ramonleenders
That's the backend example (2nd example) indeed. You could use that as base, IF this is they way to go for you. If you would like detail pages, go with pages with attributes.
simonseddon replied on at Permalink Reply
Thanks for the replies both, much appreciated. I'll look in to all options.

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.
simonseddon replied on at Permalink Reply
Will "page list" give me access to all data of all child-pages of a given parent? i.e. stored block data and custom attributes. This seems like it could be the way to go.
ramonleenders replied on at Permalink Reply
ramonleenders
Such a page list could be all children of a given parent (and/or with a specific attribute, and/or with a spefic page type etc. etc.). This list will have each and every page, so for each page you can get the attributes. You will have to do some scripting to get the attributes to display, but most of it is already available within the default Concrete5 install (pages, page lists, attributes).