I have created a very simple extension that allows for URL re-routing using regex. You could use it for vanity URLs (for email marketing or linking from another site) or any other purpose.

As it is my first extension and I am a beginner, it is at present using an array for URL mapping that is held in manifest/config.php and that has to be edited by hand at the moment.

I would be curious to know if the developers (and users) here think it would be worth trying to have a proper admin interface for this in the CMS and persist the data to the DB. Frankly, I don’t know how to do this yet and it struck me that the less DB access the better really, and it works just fine as it is.

Any thoughts?

Sweet! If it’s more for developers than anyone else, an array config would be sufficient. You can create a UI for modifying config.php values quite easily by adding an option to the Preferences page (see one of the core extensions such as Maintenance Mode.

Alistair wrote a URL Schema Manipulator extension which sounds similar. Not sure if anyone has used it other than him though!

This extension sounds cool. One of my biggest headaches has been getting a URL structure like this:


Since Symphony always requires the parameters to be at the end of the URL. Hopefully this extension would allow me to write a rule to map the above URL onto a Page with the URL:


I’ve always had to hack the .htaccess rules to do this…

I’ll have a look at the maintenance mode extension Nick, It’d be nice for it to have a proper interface of some sort.

As for your URL problem, I would have thought that could be handled.

Since Symphony always requires the parameters to be at the end of the URL.

Symphony should allow that URL structure. Any possibility to implement that in next versions? It would be great to have a URL like:


I have managed to get my extension to display a list of URL mappings by reading the array from the config.php file and building the relevant interface elements using the XMLElement class etc.

However, I was wondering if there is a standard (or approved) method for JQuery-ifying the interface for adding “sets” of mapping data.

e.g. I need to click “add item” and it add a set of input fields which can be used to add another URL mapping rule. Good old(!!) fashioned JQuery to manipulate the DOM, or is there a Symphony-centric way?

And whilst I’m at it, I need to know how to get my individual sets of mappings click-able and able to be deleted. I’m sure it won’t be rocket science, but the developer documentation is lacking as we all know.

Any help appreciated, I will get this extension on github and into the public domain shortly for testing and use.

If you’re intending on making this 2.0.7+ only, I recommend checking out Rowan’s “duplicator”. It is a jQuery plugin written especially for the Symphony backend (/symphony/assets/symphony.duplicator.js) that you’ll see used in a few places:

  • Data Source editor (for creating filters)
  • Section editor (for adding fields)
  • XML Importer extension (for adding namespaces and fields)

When you delete an item I think it stores a reference to it in a hidden field and sends it in the POST array.

Dipping into the XML Importer would be a good place to start.

Nick - that’s a useful starting point. I’m having a browse (on github) of the XML importer now but struggling to see how a custom JS file is included in the header.

In the XML importer extension.driver.php the delegate InitaliseAdminPageHead is used but it doesn’t appear to do anything so I can’t see how to get a JS file included in the header.

The duplicator looks like it should be fairly easy to use, if I can get some JS included in the Page!! Any pointers?

Rowan’s Neatify extension should have an example to help you out. Something like:

$page->addScriptToHead( URL . '/extensions/neatify/assets/select-all.js', 203);

Right - I’m making some progress, in that I can get as array of routing rules pulled from the config file to display as a custom section in the preferences page.

Unfortunately, that’s as far as it goes. If I try to save them, they save as literally the word “Array” in the config file. I can delete individual items from my ordered list on the preferences page, but cannot add a new set.

I suspect this is something to do with HTML structure and class/id naming conventions so the Jquery duplicator knows what to work with, but I haven’t figured it out yet.

Any help appreciated.

Hmm no, I think it’s more a bug with saving to the config file. I’ve come across it before and can’t quite remember how I solve it. I think I imploded the array to a delimited string to store it. You could serialize() it to store, then unserialize() when reading it back out, but this prevents people modifying it directly from the config.php itself…

Well I’m making progress with the duplicator anyway, I can now add new sets of routing rules. It’s not perfect yet but I’m getting there.

Nick - I have found the delegate for saving, I’ll have a play with serialisation options.


For the record - great API that is much more accessible than many I have tried with other CMS’ plugin systems.

For the record - great API that is much more accessible than many I have tried with other CMS’ plugin systems.

If only it were documented. You’d think someone would be working on that ;)

I think Craig should do 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