Search

I know it's not possible out-of-the-box but I am in need of some way to chain a Dynamic XML DS to a 'local' DS.

DS chaining is not possible with Dynamic Data-sources but is exactly what I need.

Specifically I need an $iso-code in my local DS. The XML returned from my Dynamic DS has an <iso-code/> node so I need to somehow access this.

Is there no way to have my Dynamic DS output a $iso-code Param based on it's <iso-code/> node? Could it potentially not add a Page Param that my local DS could use?

I'd love to be able to do something like the following in my local DS. Similar to this thread:

// EXAMPLE: does not function. Wish it would ;)
public function getIsoCodeFromDynamicDS(){
    // ***
    // Magic that fetches <iso-code> value from 
    // the XML returned by my Dynamic DS...
    // E.g.: 
    // ***
    $dynDS = simplexml_load_file(MY_DYNAMIC_DS_URL);
    $customIso = reset($dynDS->xpath('/foo/bar/iso-code'));
    return (string)$customIso;
}

public $dsParamFILTERS = array(
  '91' => '{$iso-code},' . getIsoCodeFromDynamicDS() . 'en', // 'en' is a fallback iso-code
);

Anyways: I am no PHP/Symphony dev but is there really no way to tackle this?

$this->getIsoCodeFromDynamicDS() maybe?

I'm sorry John, the code above does not actually work. It was simply meant as and example of something I had in mind.

I'm not even sure it is possible at all. Also: the issue with that code (if it would actually work) would also be that I fetch my Dynamic DS 2 times: once normally and again, only to fetch the <iso-code/>. This is less than ideal.

Is there a way to do something such as the above to allow chaining of a Dynamic DS with a local one? If so: is there a way to re-use my XML from my Dynamic XML DS instead of fetching it again (as in the above example)?

Thanks!

I haven't tried (yet) the Parametrisator extension, but I feel like it could solve your problem ;)

@alpacaaa that's the first extension I thought about and I have actually installed- and played around with it a bit but I don't think it is of much help in my scenario.

The problem is that I have a local DS on 'site1' and access a Dynamic XML DS from 'site2'. The Parametrisator extension exposes Parameters for the current site (which would be 'site2' in my case) so I still cannot access that param ($iso-code) on 'site1'.

I'd love to be proved wrong :) Thanks for thinking along!

mmh... I'm not sure I've understood your setup correctly, but I've just tested the extension and it should work in your scenario.

Basically, you have a dynamic ds which pulls data from another symphony installation, right? If that's the case, you should be able to define an xpath expression in the dynamic ds configuration editor and make it output the $iso-code param.

@alpacaaa so, that Parametrisator XPATH expression will access the <iso-code/> XML from my Dynamic DS and create a Page Param $iso-code that can be used to filter a local normal Datasource with?

I though I could not add the Parametrisator to a Dynamic XML Datasource.

I'll take another look.

Just out of interest, would some custom DS hack not be easier? (Something like my example code above)? It just seems quite trivial but I know too little of the inner workings of Symphony to grasp.

I don't get what you mean by local, but I think the point of the discussion is this:

I though I could not add the Parametrisator to a Dynamic XML Datasource.

That makes the extension so cool. I tend to prefer solutions where php isn't involved to prove how much symphony cuold be powerful and I don't see how a solution based on php code that you (apparently) barely understand can be easier than a simple and straightforward xpath expression :)

Sorry about the confusion: with local I meant my 'site1' normal Datasource, as opposed to an external Symphony install that I access through a Dynamic XML DS.

If the Parametrisator extension allows me to create a Param by exposing an XML node from the Dynamic DS, and if I can use this Param to filter another normal DS it is exactly what I need, thanks.

UPDATE: I got it to work. Thanks Alpacaaa: it is indeed possible to have a Dynamic XML DS output a Param with the Parametrisator.

To get it to work, however, I had to add my normal 'site1' DS as $ds-site1-datasource to it's Dependancies: $this->_dependencies = array('$ds-site1-datasource');

This is (sort of) described in the Known Problems section of the Parametrisator docs. I did not understand much of it but I tried it and suddenly my DS chaining worked.

Thanks for helping me tackle this issue!

Awesome! Maybe I've been a bit rude, but I think this is the best solution.

It's definitely the best way to do this and the Parametrisator extension is one that is being watched for possible inclusion into the core at a later date.

@Alpacaaa thanks for gently pushing me in the right direction ;) @brendo I think the functionality would be great but, to be honest, the Parametrisator extension is much of a black box to me. Why I had to add that DS dependency etc. for it to work is a complete mystery to me.

All I'm trying to say us that it seems a very useful extension but it probably could be documented a bit better.

I meant more the concept, not the actual execution. You should file a bug as the extension should automatically detect and add the dependency for you.

Would this work for Remote DS as well? Remote Ds is Based off of Dynamic DS right?

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