Search

A new Extension, “Section Schemas” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

Section Schemas provides an interface to creating data sources which reflect the structure of a Section. This is useful if your XSLT needs to know about your Section schema, such as the name/label of fields, their default values, or validation rules. This provides the potential for an entirely dynamic front-end form to post to an Event (I have a form controls template to follow).

Provides:

  • the total number of entries in the section
  • a list of every field in the section (label, handle, ID, type)
  • validation rules for each field (regular expression, required) for integration with client-side validation
  • existing values for Taglist and Select Boxes (should work for other similar field types too since I'm only parsing the HTML returned from a built field, extracting option and li elements)
  • counts occurrence of each tag in a Tag List field to make it easy to create a tag cloud
  • existing values for Select Box Links with ID values (same as what's returned in Symphony's Publish pages, but without optgroups for now)

Requirements

I have only tested this with Symphony 2.0.2.

Download

http://github.com/nickdunn/section_schemas/tree/master

Example

A simple Blog entry with a Title, Content, Image and Published checkbox. When the "Section Schema: Blog" data source is attached to a page, the XML resembles this:

<section-schema id="40" handle="blog" total-entries="0">
    <title required="yes" id="291" label="Title" type="input" />
    <content required="yes" id="292" label="Content" type="textarea">
        <formatter>pb_markdownextrasmartypants</formatter>
        <size>10</size>
    </content>
    <image required="no" id="293" label="Image" type="upload">
        <destination>/workspace/uploads</destination>
        <validator>/.(?:bmp|gif|jpe?g|png)$/i</validator>
    </image>
    <published required="no" id="294" label="Published" type="checkbox">
        <default_state>on</default_state>
        <description>Show this post on the public site</description>
    </published>
</section-schema>

Thoroughly awesome.

I had to install and use this extension to really understand what it does.

Now I know that it is really cool!

Wow!

oh, and I love you, err... you know what I mean :-)

Thanks guys, hope you find a use for it. I've updated the initial post to include an XML sample to illustrate what the extension does.

I'm planning a proof of concept to create an entry form completely dynamically, much in the way that the Publish forms are created. But using XSLT on the front end. Although it'd seldom be useful in most situations (since form layouts are never that simple) it's an interesting idea.

But the initial reason for this extension is to get the validation/required information into the front-end for JavaScript validation.

Updated to v1.1 to include optgroup support when writing in values for Select Box Link fields, and adds a count attribute for Tag Lists to make it easy to create tag clouds.

This sounds great, Nick! I can't wait to give this a try. I hard-coded XML to get something like this working in my ensembles.

If we could combine your extension with Alistair's long-awaited plans for a navigation editor, this would be amazing!

Give it a try — I'd appreciate any comments you have.

You of all people may be interested in my form controls template which persist values with Symphony events. You could potentially create the HTML form completely from the XML returned by Section Schemas. All that is missing from the XML is the Main/Sidebar alignment and ordering. It would be trivial to add this in if required.

Symphony 3 may well use a similar idea since its backend forms will be generated by XSLT. I'd be very interested to hear what Allen/Alistair have to say about this implementation, and whether we can cross-over somewhere.

Updated to 1.2 with the following improvements:

  • Select Box static values now arrive! (bug fix)
  • Handle attributes appended to static values for Select Box, Author and Taglist fields
  • Taglist tag counts updated (bug fix)
  • Single input fields with pre-populated fields now return these (e.g. Date, Order Entries number)
  • All XML nodes are handle-ised, so underscores are now hyphens (for consistency)

This is kind of minor but wouldn't it make more sense to place the navigation for Section Schema under blueprints?

Whenever I change this, it appears under different menus in different builds. I have a few different menu structures on the builds I have this running on, so have to edit the fetchNavigation array to match.

When Symphony 2.1 is released I will update this to use the new method to appending items to the navigation — by name rather than array index.

Thanks for the extension, makes it a whole lot easier to generate a tag list and order it by the amount of occurrences.

@Nick:

When Symphony 2.1 is released I will update this to use the new method to appending items to the navigation — by name rather than array index.

I was rather sure that this already works in 2.0.6.

Section Schemas updated to version 1.3 on 29th of December 2009.

I have made this option add itself to the “Blueprints” dropdown. This version is therefore only compatible versions of Symphony that have Navigation Groups.

Section Schemas updated to version 1.4 on 5th of January 2010.

This release fixes a stupid bug where a redundant line of code was left in (thanks tonyarnold!) and adds an array of incompatible fields that would otherwise prevent Section Schemas from working.

Great - thanks, Nick! I’ll be taking the time to update to the latest build of Symphony and this extension as soon as 2.0.8 is out.

Service with a smile ;)

Run into an error here when trying to save a section schema under symphony 2.07.

Missing argument 1 for AdministrationPage::__construct(), called in /home/rphilp/public_html/default/extensions/section_schemas/content/content.list.php on line 74 and defined

An error occurred in /home/rphilp/public_html/default/symphony/lib/toolkit/class.administrationpage.php around line 19

The following is line 74 from section_schemas/content/content.list.php

$blueprint = new contentBlueprintsDatasources();

The class contentBlueprintsDatasources inherits from AdministrationPage. The contructor:

function __construct(&$parent){

I assume that this lack of a required parameter is therefore causing the problem, but having looked at the 2.06 code on github, it appears that this has not changed for 2.07 and so I assume that the problem lies with verbose error reporting where this was previously being supressed?

Hopefully this will shed some light and enable the problem to be fixed.

Please tell me if this forum is not the place to discuss things at code level!!

I assume that the problem lies with verbose error reporting where this was previously being supressed?

Most probably. Try this:

$blueprint = new contentBlueprintsDatasources(Administration::instance());

Please tell me if this forum is not the place to discuss things at code level!!

At the moment it is the best way. The Issue tracker for the extension is the proper place, but since it doesn’t yet email notifications the chances are I’d never see it.

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