Search

I wonder how do I create my custom function so I could use it in xslt processing? In my case, I need to call a function that would fetch (via an http request) an XML node.

Thank you,

I found this resource. Very helpful.

Funnily enough, I found a couple of very helpful-looking articles at that site on custom data sources earlier today, too. Good to know about Mr. Sasser's site!

Careful to not mix up your application layers. What exactly is it you want your template to do? Couldn't you solve it with a Dynamic XML Datasource?

In my case, I need to call a function that would fetch (via an http request) an XML node.

As phoque suggests, mixing this kind of logic into your view goes against the separation of concerns that Symphony complies with. Fetching via an HTTP request should be the role of a data source (the model/controller part, in MVC speak) rather than being logic embedded into the presentation layer (view).

I solved it by re-writing the grab function in the dynamic xml data source. Now it calls exec multiple times (for as many entries in a section data source).

I solved it by re-writing the grab function in the dynamic xml data source.

Perfect, that's how I would've done it too. Make sure to set the return value of allowEditorToParse() to false, otherwise your DS editor will overwrite your custom code.

Perfect, that's how I would've done it too. Make sure to set the return value of allowEditorToParse() to false, otherwise your DS editor will overwrite your custom code

Right, but by doing this I constantly felt like I was swimming upstream. I'd rather have a field that links to a dynamic data source...

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