Is there any way to embed code in a field? As I remember regions supported PHP code.
I have several pages, where I need dynamic content like a list of child pages or the contact form.
Is there any way to embed code in a field? As I remember regions supported PHP code.
I have several pages, where I need dynamic content like a list of child pages or the contact form.
You can always embed code in your fields - whats done with that code then depends on your frontend.
Rendering and layouting is a thing that is formally done within the frontend (which is the spot that receives your cockpit api data) - I guess thats why regions have been removed from the cockpit core.
But if you are looking for the regions module that has been a part of cockpit once take a look at this:
This is the original regions module you used to know back then. Artur just stripped it right out of the core and made a addons out of it. Installing this addon to your cockpit installation will bring back the regions as you know them from previous cockpit versions.
But if you do not like to install this addon you could perhaps use repeaters or collection-links in order to represent child views/pages
What if the client wants to insert something like a form within the content? Or a “snippet” with the latest 3 receipts from the “cooking collection”? Or something else you can’t do easily from a markdown/wysiwyg editor.
Thanks for the link anyhow. I will have a look at it.
I guess you could do it like wordpress does. Just give your client the possibility to use some kind of shortcode within his content sections. Something like [RECENT_RECIPS] oder %RECENT_RECIPS%.
You can then parse this string within you frontend and replace it with the dynamic recip list.
I know that is not convenient but at last it solves your needs.
Perhaps a collection link field could also do the trick - but I barely used collection links yet, so this hint is without guarantee.
Yeah, thanks for the hint. I’ll will have a look at plugins. Perhaps I build something for that kind of situation.
the tinymce editor supports an embed feature:
maybe a plugin for it that does exactly what you need?
maybe other option is to use the short codes and handle the replacement when retrieving from the api on a collection.find.after