Search

I am working my way through my first symphony site. I have two sections – gallery and gallery objects linked with a section link. On the gallery data source I filter the results by a gallery-title parameter on the page and on the page I have the gallery title as a url parameter. This displays said gallery data when the title handle is used and displays no gallery section data when the page has no url parameter.

 <gallery>
        <error>No records found.</error>
  </gallery>

The gallery data source outputs a parameter which is the system id and the attached data source of art objects filters results with the system id.

$ds-gallery '124'

Here is the puzzling thing. When there is no gallery-title url parameter, a system id shows up for one of the galleries and the art objects for that id are pulled into the xml even though no data from the gallery section shows up. It is always the same system id unless, I have a gallery-title in the url and then the specific gallery information and art objects called by the url parameter are pulled into the xml.

Required url parameter is set. Why would this be happening? If there is no gallery parameter present the page shouldn’t be pulling a system id from the data source, or should it?

TIA in advance. Thanks

I mean I can filter the extra data out in the Stylesheet, but I’m a neat nick and wonder where the call for this information is coming from.

It sounds like the datasource parameter is not honoring the param requirement, so you’re getting the first ID from all of your gallery entries. A quick test is giving me that same result: the ds-params are output regardless of the Sorting and Limiting settings. Can anyone confirm or dis-confirm?

Whew! I thought is was just me… now it is just me and you, ashooner.

This discussion may have gone nowhere for two reasons, that I can think of.

1) It may not be a repeatable problem.

2) It may be an awkward problem, similar to “Why washing machines only eat one sock in a pair?” A low level, difficult to trackdown issue that clutters up the virtual sock drawer,but seems too complicated to solve given the scope of the problem. That extra millisecond hit as you push the single socks out of the way looking for a pair, isn’t enough spark to solve the problem.

For my purposes, because the extra data sample is quite small; maybe 4 or 5 hits of a table of 20 or thirty records, it isn’t a big problem. I can just filter the data out in the XSLT.

However, if I was designing a fixtures catalog where the data called was hundreds of small records, it would create and lag in processing.

Seems that the query is still executing when the parameter is not set and, while there’s a memory saving of the XML not needing to be generated, the value definitely should not be there. Imagine a scenario where you are using the existence or value of this parameter to hide/show items in the UI!

I can replicate this also. One for the bug tracker methinks.

This discussion may have gone nowhere for two reasons, that I can think of.

Not intentionally so — chances are, an issue won’t be resolved without raising a bug report. They give nerds things to do when they’re bored :-)

Thanks FredD for describing the issue – can I please ask you to put this on the bug tracker.

Thanks Nick, Allen,

I added it to the bug tracker. Hope I described it correctly.

Excellent. Cheers mate.

I’ve had a look at this and I think there are two things happening:

Firstly, when you have a DS filtering by a URL Parameter and that parameter doesn’t exist, it ignores the filter, thereby returning the DS as if that filter isn’t there. So if you have your Gallery DS set up to filter on {$gallery-handle} and set the limit to 1, if the gallery-handle is not in the URL it will ignore that filter and show you the latest one gallery entry.

Adding $gallery-handle to the “Required URL Parameter” box solves this problem insofar as if the parameter doesn’t exist the XML will be empty. However there is a bug whereby the DS will still run in the background and still create an Output Parameter if you’ve told it to do so.

I have patched this bug:
http://github.com/nickdunn/symphony-2/commit/47f7a72aec251627593e3689c90bbbd65703a914

This code executes when the “Required URL Parameter” isn’t found, so as well as returning empty XML, we also need to clear output parameters and included fields, so that no additional queries are attempted by Symphony.

Secondly, there is the issue of Gallery Items still appearing in the XML when the $gallery-handle isn’t set. Unless you have also added the Required URL Parameter to the ‘Gallery Items’ data source, the filter that filters gallery items by the chosen gallery will be ignored, and the latest entries returned.

The fix here is to add $gallery-handle to the Required URL Params box for this DS also.

Of course there is another fix you can use on both DSs that will get around this problem entirely. Your Gallery DS filter could read:

{$gallery-handle:0}

This means that if the gallery-handle URL Parameter value isn’t set, use a value of 0 instead. Since it’s unlikely you’ll have a gallery title equal to 0 (or indeed a System ID of 0 if you use this in your filter) if will prevent the feature of filters “falling-through” when parameters are not set.

Hope this helps clear things up.

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