Search

Hello,

I'm currently working on 8th (or sth like that) project using Symphony and I always struggling with a following issue:

I'm gonna use my current project as an example: the project has many pages which are similar, they all have a little SM-based gallery of pictures (displayed in sidebar), header, content (CKE) and that would be all. However, there are 2 types of pages which have gallery and header but don't have text. Instead of text, they have different fields like telephone, e-mail, photo, etc.

There are two solutions. First, to put identical gallery and header fields to all sections representing different page types. This is generally copying of the same functionality which makes project less modular and much harder to maintain and scale.

Second solution is to have seperate section for common fields (header and gallery). But there is a problem, because adding new page would be seperated into two additions: to a "specific fields" section, and to "general fields" section. And this is the simplest case, I can easily imagine the case when one entry would be separated into 3 or 4 "part-entries" and this is absolutely unacceptable.

It could be easily done with section inheritance. I think it's an intuitive concept and there is not much to explain. We create a section "Page" with fields "Header" and "Gallery". After that we create "Article" section inheriting from "Page" with "Content" (textarea) field. After that we can add, let's say, "Contact" section inheriting from "Page" and add Subsection Manager ("People") with phone numbers, e-mails, etc...

This would also make SEO easier. Every entry (no matter from what section) could inherit from SEO section and have it's own SEO fields to fill.

Inheritance is very loose idea, it could be also interfaces-like solution. Doesn't matter, the idea is not to repeat myself, which ofc is a good practice.

Good idea, or am I missing something?

Hmm maybe it could make sense in some cases where you share a lot of fields.

Whilst it is not inheritance maybe you can use subsection manager?

Not exactly the same but you can say you have a section Header.

Then page includes header (subsection) might be a bit more hassle to save stuff like that just an idea though. pretty sure creating inheritance could take a while...

I've needed this a couple of times, but got around it by using a single section, a "Type" dropdown, and Publish Tabs to break up fields and hide them out of the way.

We create a section "Page" with fields "Header" and "Gallery". After that we create "Article" section inheriting from "Page" with "Content" (textarea) field. After that we can add, let's say, "Contact" section inheriting from "Page" and add Subsection Manager ("People") with phone numbers, e-mails, etc

This doesn't make much sense to me. Perhaps it's the thinking of "pages" that is confusing matters, since I would not expect the same core fields to be shared between an article and contact details. It sounds as though for this project you're looking more for a page based CMS than an object/entry based CMS?

I've needed this a couple of times, but got around it by using a single section, a "Type" dropdown, and Publish Tabs to break up fields and hide them out of the way.hide them out of the way.

Yeah, been through that too. I do that by applying my custom javascript.

Pages may be confusing, you're right. But here you have an example:

My client has a website with different "pages", and wants a possibility to add them dynamically. And they are entries of some section in Symphony. There are three types of "pages", every of them has different fields. But all those types also share some functionality. This could be header, gallery of pictures (SM) shown in sidebar (my current project has this feature) and SEO tags.

Inheritance would do the trick, everything would be clean and easy to understand.

I think in this case a little bit of duplication is fine. So long as they are named consistently then your frontend templates can all be applied to the same XML.

I'm not aware of any extensions which allow true section inheritance... most likely nobody has tackled the problem because it is very complex!

However you should keep an eye on klaftertief's GIthub account because he has been working on a page templates/prototypes extension which would satisfy you requirement. You configure a ''page template" and specify which sections it is tied to. When the user adds a new page they can attach one or more entries from each section to the page, all in one form.

So flipping it on its head, what I think you actually need is not section inheritance, but a UI that enables you to couple together single entries from multiple sections in one single view (establishing a one-to-one relationship between them all) so that they act as one entry. But the data still remains in separate sections.

However you should keep an eye on klaftertief's GIthub account because he has been working on a page templates/prototypes extension which would satisfy you requirement. You configure a ''page template" and specify which sections it is tied to. When the user adds a new page they can attach one or more entries from each section to the page, all in one form.

I read this, but got sidetracked from work again. I'll try working on it...

I read this, but got sidetracked from work again. I'll try working on it...

I WILL KEEP REMINDING YOU UNTIL IT IS FINISHED

This is what I need :-)

So flipping it on its head, what I think you actually need is not section inheritance, but a UI that enables you to couple together single entries from multiple sections in one single view (establishing a one-to-one relationship between them all) so that they act as one entry. But the data still remains in separate sections.

Yeah, that would definitely do the trick!

klaftertief, I can't wait to see your extension working. You'll be my hero! ;P

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details