Search

A new extension, “Page Prototypes” 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.


A Symphony extension enabling the creation of pages from predefined prototypes.

This extension is heavily inspired by czheng’s Page Templates extension and it is meant to be its successor.

Installation

  1. Upload the ‘page_prototypes’ folder in this archive to your Symphony ‘extensions’ folder.
  2. Go to System > Extensions, select “Page Prototypes”, choose “Enable” from the with-selected menu, then click Apply.

The extension adds two tables to the database and adds two columns to the pages table. So please backup your database.

Usage

Managing Prototypes

Page Prototypes can be managed at Blueprints > Page Prototypes. Creation/editing works almost exactly as with Pages, but with a few notable exceptions:

  • There are no fields for “Parent Page” and “URL Handle”.
  • Template XSLT files are stored in /workspace/pages, prefixed with _page_prototype_.

Create Pages From Prototypes

You can create a new Page by either copying a Prototype or by creating a reference to a Prototype. A referenced Page uses the XSLT Template and the URL Parameter, Page Type, Events and Data Sources of the referenced Prototype instead of its own XSLT Template and settings.

There are currently two ways to create new pages using your prototypes:

  • When browsing the list of available templates, click the Copy or Reference link in the “Available Actions” column.
  • Immediately after creating a template you will see a Create Page Copy from Prototype and Create Page Reference from Prototype link in the page alert.

Edit Pages

The extension adds a new fieldset to the pages editor. You can change the connected prototype there and choose between the copy- and reference mode.

Ah, you can watch the extension in this video preview.

Is there any reason why ‘page type’ needs to be locked when using a page prototype by reference? This seems like an excellent extension for cutting down on the number of necessary template files when they are all the same.

For instance I use separate Pages for each static page, and set their page type to ‘static’ for filtering in the ‘Field: Page Select Box’. The template for each page all import the same utility template, so I end up with just a bunch of templates with the exact same content. On the other hand, some of these Pages needs to specify slightly different page types. For instance the home page needs ‘index’ and usually ‘hidden’, in addition to ‘static’. But I can’t add all those to the prototype.

I thought about that problem a couple of days ago. A solution would be to add a fieldset to the Page Prototype configuration that allows the developer to choose which of the settings/resources should be overridable in the Pages Editor. Thoughts?

I was also thinking a bit more about this after my initial post, more specifically what kind of uses I could foresee of this extension.

One of the ideas I had was.. What if it worked like inheritance in OO? Instead of either inheriting just the data sources etc. of the prototype, or on the other hand overriding them completely, it would be a mixture. You’d get all the page types, data sources and events of the prototype, but be able to add your own.

Anyway, the main thing I like about this is being able to avoid multiple XSL files which are all the same and instead having them all reference a prototype XSL file. A basic set of page types, data sources and events would also be relevant, but a lot of times I think I’d like to be able to customize these slightly.

The implementation of the logic and the interface for the choice between inheriting and overriding behavior is easier than the implementation for an OO like inheritance.

If I find a good and simple way for the latter I’ll do this, otherwise the former is a viable alternative.

Hi all, currently got two websites on the go, for which this extension would be absolutely awesome.

I’ve downloaded the extension, installed it, created a basic template and then tried to create a page by reference and received:

DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity, line: 65

It’s failing on line 168 of extension.driver.php as it seems the $context[“output”] array item is empty?

Is there something I’ve missed?

Cheers, Tim.

Oh, and I’m running the most current version of Symphony (2.1.0)

Hi Tim,

thanks for finding a bug. Can you please post it to the Issue Tracker, including information about your server environment?

As a first guess/hack you could change line 115 in extension.driver.php from

        $dom->loadHTML($context['output']);

to

        function maskErrors() {}
        set_error_handler('maskErrors');
        $dom->loadHTML($context['output']);
        restore_error_handler();

as skeary did here for his Page Fields extension.

No problemo, will post the info now.. Thanks for the hack/guess :)

Ok, I think I fixed the issue. It’s basically the same as the hack above, I’m just suppressing warnings due to invalid markup/unterminated entities for $dom->loadHTML($context['output']); by prepending an @ to the expression. Just pull the latest code from GitHub and let me know if it worked.

Page Prototypes updated to version 0.6 on 9th of February 2011

Symphony 2.2 compatibility update

Awesome, thanks!

Does this extension allow for author-logins (not developers) to add pages to the site?

Does this extension allow for author-logins (not developers) to add pages to the site?

Nope, it modifies the normal pages editor. This extension was meant to be a part of a bigger "static content management" project I never finished. There is a light pages editor accessible for authors in there. I could send you the unfinished project or extract just the page editor part.

Does this extension work fine with "language redirect" and "multilingual field" ok?

It should, but I haven't tested it. It should, because the extension has nothing to do with sections and fields. It just creates an instance of a prototype or references a prototype with the attached events and datasources and its template.

Great stuff...will give it a go over weekend! thanks for building this by the way!

I am thinking about using this extension for an upcoming project. Is it compatible with the latest Symphony (2.2.3)?

Another thought I had regards the age-old question of 'page structure': would it not be awesome if there was a field extension that would allow editors to automatically create a (Prototype-) 'Page by Reference' from an entry?

What I mean is that I would love to be able to create a Section 'Content Pages' - used for the static contentpage structure of the site - and in a new contentpage Entry could select the 'Page Template': this would then create a new Symphony Page by reference automatically.

Is it compatible with the latest Symphony (2.2.3)?

I haven't tested it with 2.2.3, but I think it should work because the changes from Symphony 2.2 to 2.2.3 weren't too big.

Another thought I had regards the age-old question of 'page structure': would it not be awesome if there was a field extension that would allow editors to automatically create a (Prototype-) 'Page by Reference' from an entry?

This extension was (is) actually part of a bigger picture (set of extensions) to allow editors to better manage static content (pages). I started working on a Pages editor light extension to allow editors to create and reorder new pages and add entries from static sections to the page, on the page editor itself. So it would be the other way around from your idea. I'll keep it in mind, but I don't know when I find the time or job to work on this project again.

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