Search

A new Extension, “XML Select Box” 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.

This is a very early idea — an XML Select Box:

(URL removed in favour of Github)

I’m off on holiday for a couple of weeks and tonyarnold was asking after this on IRC so here is my first attempt. Feel free to run with it while I’m away.

The basic idea is that you can add a Select Box that receives an XML file for its values. When configuring the field set the XPath to grab the items, and then Xpath for the text/values (relative to each item), e.g.

Item XPath: /countries/country
Label XPath: text()
Value XPath: @iso-code

It also accepts a URL for an XML feed. I started caching but didn’t test so this might be broken.

I was looking for something like this last week. Thanks nick!

Awesome. This will come in quite handy!

I’d like to add that this certainly isn’t stable — but I’d value help in beefing this up into a proper extension.

Thanks Nick - I owe you. I’ll github it and do some cleaning :)

So this could serve to display a dropdown combobox field(like a section link, or the the language selection from the languagefield extrension) on a frontend (with events) editing form?

It does appear that’s the case. I’ll spend some time with it tonight and post the github URL back here once it’s all working as expected - looks like a really useful piece of work!

OK, I’ve tidied up the countries.xml document and tested that this works in the backend (I haven’t tried passing this through to the front end yet).

http://github.com/tonyarnold/xml_selectbox/tree/master

Basically, the only thing I have to add to Nick’s instructions above is that you can use the included Country Code list by specifying the following options in your xml_selectbox field instance:

XML Location: ./countries.xml
Item (XPath): /countries/country
Text Value (XPath): text()
Value (XPath): @abbr

Have fun!

Well I didn’t like that in the language field extension the lists of languages with their iso notations were hardcoded in php. So this might be good to replace those with a xml file, and also redesign the extension to serve single country headers so safari understands them…

Tony, Richard, thanks so much for working on this in my absence. Cool!

I added it to a 2.0.3 site and it gives me a 500 error when I try and create a new entry. My remote host won’t allow me to enable error reporting so I’ll check this out locally when I can.

Should the ordering of items be configurable, or use the default order in the XML? I ask because the included countries.xsl orders the countries by their @abbr values, whereas in the UI it makes sense to order them by the country names.

@newnomad — the intention wasn’t to replace or compete with the Language Field extension. The use of countries is purely exemplary, since the field is generic enough to use any XML. Indeed one of the ideas behind this field was founded on your requirement of listing photo album titles in a drop down to choose from. You could supply this field with an XML/RSS feed of your albums and voila.

Needs a little bit of testing, but let’s try and release this in the next week or two :-)

Hey no worries, Nick. I don’t have access to anything lower than 2.0.5 for testing at present - it didn’t occur to me to even try! Thanks for the code - I didn’t really touch too much, it was Richard who did the actual work :)

I added a cache field in the table schema and that might be what it is choking on if you’re upgrading.

Try running the following SQL to upgrade: -

ALTER TABLE sym_fields_xml_selectbox ADD cache int(11) NOT NULL default 0

This was on a build that had not seen this extension before. But ta, Ill work from that when I start debugging.

Tony, I made a few commits the other day (http://github.com/nickdunn/xml_selectbox/commits/master/). I think I sent a pull request through Github — let me know if you need me to issue another.

This is the extension that I’ve been waiting for! This has such wonderful potential. Tony and Nick, thank you both for pulling this together. This is SO COOL!

@nickdunn, @tonyarnold: for the sake of the Unofficial Extensions Library, whose repository should I be referring to?

Tony’s is the original that I have forked so if he gets around to pulling in my updates, use his. But I’m happy to become remain the owner if Tony chooses.

This extension is a killer app.

Sorry guys, I’m not ignoring this thread - just got distracted. I honestly think Nick’s repo should be the primary one - it’s really his extension, I was just looking after it for a bit :)

How do I make yours the primary repo, Nick? - my github-fu is lacking.

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