Search

Hello Symphony Community,

this is my first post here so please be gentle if there is any problem ;-)

First of all I’m very happy with the system but there is one question about sections and fields.

Is there a possibility to dynamicly change the amount of fields in a section during the creation of an entry?

What I mean is kind of illustrated in the screen shot I added to this post from the CMS OpenCms.

Example: I create a section called “article” with a field “paragraph”. What I want to do is just add one field “paragraph” and dynamicly set it to, lets say, three paragraphs while creating an entry and to five paragraphs in another entry.

Is that possible?

Thanks in advance,

Monika

Is that possible?

Hi Monika, welcome to Symphony!

Unfortunately no, it isn’t possible. The fields in a section are fixed so that the structure is consistent across all entries. There are a couple of ways you could achieve this:

The simplest is to use a large Textarea field and ensure it has a Markdown text formatter. When you include this element in a Data Source and view the XML, you’ll see multiple <p> elements, one for each paragraph you write. You can use XSLT to iterate over these p elements and display them however you want.

The next idea is to include a maximum number of optional fields in your entry. For example you could add 5 Textarea or Text Input fields to your section, the first being required, and the other 4 optional. This would allow you to add “between one and five” paragraphs.

The next is to use separate sections. This doesn’t make sense for “paragraphs”, but is used a lot for attaching images to articles. The default blog workspace when you install Symphony from the ZIP file is a good example of this. There are two sections: Articles and Images. Fields in Articles are things such as Title (input), Content (textarea) and Published Date (date). A separate Images section has fields such as Caption (input), Image (file upload) and “Article” (a Select Box Link field linking to the Articles section).

This means that you establish a one-to-many relationship between an Article and Images. For each article entry you create, you can create multiple image entries. The different is that in Symphony you can’t (yet) create all of these entries from the same screen so there is no “Add another image” button when you are editing an article entry.

The Mediathek field (a popular extension) aims to mitigate this somewhat — it requires that you have established this one-to-many section structure, and it provides some UI to allow you to more easily assign child-entries to parent-entries. I’m not sure whether it would be logical to use this for your “paragraphs” example though, since Mediathek is more appropriate for media assets (images, videos etc).

Thank you for your quick and detailed answer!

Thinking about it, my paragraph example might be a bit too simple but i guess something like the blog approach might work for good me.

so… still loving symphony :-D

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