Search

How can i output multiple parameter values from my custom ds? When i use an array like $param_pool['ds-' . $this->dsParamROOTELEMENT] = array('item1','item2','item3'); it results in comma separated values <ds-myds>item1, item2, item3</ds-myds>. Is it ok?

Shouldn't it output something like <ds-myds><item>item1</item>... ???

Another question: I'm trying to filter a section ds with my custom ds using {$ds-myds} on a text input field. But it returns all the entries!

If my custom ds outputs <ds-myds>item1</ds-myds> and i have 4 entries (item1, item2, itemA, itemB) it returns all 4 entries not matching the filter!

What is going wrong?

Regards part 1, I think comma separated is correct but I'm not 100% sure I'll let the otehrs reply.

For the second part I think that what you are missing is the required field in the second data-source. I think you have to set $ds-myparentds as required in order for it to run after in the DS orders. This can be noticed by checking the naming most likely your first data-source is 'alphabetically larger' then the one which requires it thus its running after so your parameter is empty matching all entries.

Thanks Jonathan. I've found another problem here. I was using $dsParamROOTELEMENT = 'my_ds'; instead of my-ds. In the paramater pool it appeared as ds-my-ds even though the value was my_ds. The filter just worked when i corrected it to my-ds.

Please post your custom data source.

I would rather use an extension and subscribe to the FrontendParamsResolve delegate:

public function getSubscribedDelegates(){
    return array(
        array(
            'page'     => '/frontend/',
            'delegate' => 'FrontendParamsResolve',
            'callback' => 'addParam',
        )
    );
}

public function addParam(&$context){
    $context['params']['test'] = array('test1','test2','test3',);
}

The output will be:

<test>
  <item handle="test1">test1</item>
  <item handle="test2">test2</item>
  <item handle="test3">test3</item>
</test>

Stupid me. After re-reading the original post, my comment above is no good idea. I didn't notice that you query actual data from the DB. In your case a datasource is the right place to do it.

Stupid me. After re-reading the original post, my comment above is no good idea.

I suggested the same thing and then changed my comment above after I came to the same conclusion. I can't tell from his original post where the problem lies though. Need to see the custom data source.

I don't know what i changed, but now $param_pool['ds-' . $this->dsParamROOTELEMENT] = array('item1','item2','item3'); (the same code as before) is showing as <ds-myds><item>item1</item>....

Sorry guys, i think i wasn't much clear at this point:

Another question: I'm trying to filter a section ds with my custom ds using {$ds-myds} on a text input field. But it returns all the entries!

The custom ds does not query data from the DB, but i'm using it's output parameter to filter a ds that does query data from the DB.

Thank you very much guys! Thanks for the code too. May be helpful some other time.

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